Here I have some JSON generated by Jenkins, I would like to access the value Started by user XXX
in the below JSON with GSON.
Although as you can see there are two causes
in the actions
array. Although sometimes there is only one (In which case just return that one).
Question: How can I access the first causes
only OR even better conjoin them both so I could access it like Started by user XXX - Rebuilds build #2
I cannot change the JSON unfortunately.
Edit* I understand the title is probably not the best although I cannot think of another way of phrasing it so if anyone can think of a better one I would be much obliged.
{
"jobs" : [
{
"name" : "Test Build",
"url" : "URL",
"lastBuild" : {
"actions" : [
{
"causes" : [
{
"shortDescription" : "Started by user XXX"
}
]
},
{
"causes" : [
{
"shortDescription" : "Rebuilds build #2"
}
]
},
{
"parameters" : [
{
"name" : "ENVIRONMENT",
"value" : "PROD"
},
{
"name" : "RELEASE"
}
]
}
],
"building" : false,
"duration" : 126580,
"estimatedDuration" : 74509,
"number" : 3,
"timestamp" : 1445261252000,
"url" : "URL",
"builtOn" : "D-slave"
}
},