I'm having some problems with parsing this json file. Seems like i'm having some problems with parsing the object-keyname and I'm not quite sure how to solve this.
My JenkinsfileProperties.json file looks like this:
{
"predefines": {
"69dA06x01": {
"customer": "hello1",
"label": "test1",
"opt": true,
"license": "baseline"
},
"69dR08x06": {
"customer": "hello2",
"label": "test2",
"opt": true,
"license": "baseline"
}
}
}
My groovy file looks like this:
conf = getJobConfiguration scm: scm, local: "checkout", file: "JenkinsfileProperties.json"
conf.predefines.each { predef ->
builds["Build ${predef}"] = build(predef)
lints["Lint ${predef}"] = lint(predef)
unitTests["Unit Test ${predef}"] = unitTest(predef, predef.customer)
}
In my head config.predefines.each { predef -> will give me each instance of 69d.... along with its children. So accessing a child is simply the matter of doing predef.customer or predef.label etc.
Right now i get No such field found: field java.util.AbstractMap$SimpleImmutableEntry customer. What am I doing wrong?
I need to be able to iterate through the 69... entries and I will also have to be able to get their value i.e. 69dA06x01