groovy操作map,json

 
  
def slurper = new JsonSlurper()
def address = ["address_id":"1","name":"yuyu"]
println(address.toString())
println(address.toMapString())
def str = JsonOutput.toJson(address)
println(str)
println(JsonOutput.prettyPrint(str))
def address2 = slurper.parseText(str)
println(address2)

 
  
 
 

你可能感兴趣的:(groovy)