JSON response in groovy

Groovy is very nice when it comes to grabbing and parsing a JSON response. If there is no need to use a proxy, it is enough to:

def response = new JsonSlurper().parseText url.toURL().text

Result object contains for example:

Capture

As easy as that.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s