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)