Parse JSON In Groovy To Get Values (python Dict)
I have a dictionary that I get as a python dictionary in groovy which I then assign to a variable x : def x = '{'JIRACHEF': 'PIBEP-2135', 'JIRADEPLOYER': 'PIBEP-2136', 'JIRASINGLEB
Solution 1:
You can use the LAX slurper (in recent versions of Groovy):
import groovy.json.*
def x = "{'JIRACHEF': 'PIBEP-2135', 'JIRADEPLOYER': 'PIBEP-2136', 'JIRASINGLEBUILD': 'PIBEP-2137'}"
def parsed = new JsonSlurper().setType(JsonParserType.LAX).parseText(x)
println parsed.JIRACHEF
println parsed.JIRADEPLOYER
println parsed.JIRASINGLEBUILD
Post a Comment for "Parse JSON In Groovy To Get Values (python Dict)"