>
> Thanks for that, I'm only interested in reading though, I came up with a
> solution although I'm rusty with Groovy but it will make do until a better
> approach appears.
>
This method enables me to write test json in the console for test purposes.
def token1 = 'Replaced-Token1'
def token2 = 'Replaced-Token2'
def tokenMapper = [
'${token1}' : token1,
'${token2}' : token2,
]
def jsonFile = new File('d:\\test.json').text
def json = new JsonSlurper().parseText(jsonFile)
json = json*.collectAll{
element ->
if(element instanceof String) {
if(element.startsWith('${')) {
element = tokenMapper[element] ?: element
}
}
element
}
println(json)
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/4d87716b-f5b6-4d19-bdd5-b89f2e262ecf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.