Quantcast
Channel: New board topics in SmartBear Community
Viewing all articles
Browse latest Browse all 21061

Building json using JsonOutput

$
0
0

Hello,

 

I need to produce json looks like:

 

{
    "method": "GET",
    "path": "news",
    "synchronization-type": 2
}

I have tried to do somethink like this:

 

import groovy.json.JsonOutput

def synch = new Synchronize()

synch.method = "GET"
synch.path = "news"
synch.synchronizationType = 2

def json = JsonOutput.toJson(synch)

return JsonOutput.prettyPrint(json)


class Synchronize {

	String method = null
	String path = null
	Integer synchronizationType = null
}

But like You can see there is synchronizationType but I need to map this to synchronization-type. Do You have any suggestions how to do that?

 

 

 


Viewing all articles
Browse latest Browse all 21061

Trending Articles