recoInrelax
recoInrelax

Reputation: 707

groovy get http parse json/xml

Hey i have this talk to do:

What is the best way to do that? I would like some hints on this. Thanks in advanced, RR

Ps. i searched for it in here, but i found examples too complex to understand.

Upvotes: 1

Views: 5822

Answers (1)

tim_yates
tim_yates

Reputation: 171154

Does:

def json = new JsonSlurper().parseText( new URL( 'http://localhost:8983/solr/select/?q=tree' ).text )

Get you to where you want to be?

Right, so this is Grails prior to 2.0, so can't use JsonSlurper as that needs Groovy 1.8+

Can you try:

def json = grails.converters.JSON.parse( new URL( 'http://localhost:8983/solr/select/?q=tree' ).text )

Upvotes: 7

Related Questions