groovy get http parse json/xml

Hey i have this talk to do:

  • Use solr api, use this url: http://localhost:8983/solr/select/?q=tree
  • Get the answer via json/xml, deserialize it to a map objects

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.

Answers


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 )

Need Your Help

Getting started with converting code behind to client side

javascript asp.net ajax html5

I am wanting to convert the code behind portion of my asp.net web forms application to client side ajax, javascript... not sure what.

Web application using OWIN and NancyFX how to make it public

owin katana nancy

I have created A simple website using OWIN and NancyFX as a learning experience. Now i want to make my website avaliable public or at least on my local network(i want to share my experience with my