To achieve your goal, you can use the following approach for working with json:
import groovyx.net.http.HTTPBuilder def http = new HTTPBuilder('http://www.MyYouTrackServer.com') ... http.get( path : '/MyIssue-25', contentType : 'application/json' ) { resp, reader ->
Note that the query parameter of the get() method is optional, this parameter is used for the URL of the request approach, such as https://twitter.com/search?q=asd , for this case the query parameter will be query : [ q : 'asd' ] .
So, back to the code, in the reader object you have an instance of net.sf.json.JSONObject to work, look in its API .
To show a small example, I have a server in http: //localhost/index.json that returns the following json { "a":"a", "b": { "b1":"b1", "b2":"b2" }, "c":"c" } to work using, follow the code:
import groovyx.net.http.HTTPBuilder def http = new HTTPBuilder('http://localhost') http.get( path : '/index.json', contentType : 'application/json' ) { resp, reader -> // cast the object it not necessary... I cast it // to have the method suggestions by IDE net.sf.json.JSONObject read = reader println read.get("a") // prints "a" println read.get("b").get("b1") // prints "b1" //... // you can also use this approach println read.a // prints "a" println read.b.b1 // prints "b1" println read.b // prints [b1:b1, b2:b2] }
UPDATE
I read your questions again, it seems, for your description, that you are trying to read the problems from YourTrack in xml format. For this, an approach that really looks like json , in this case the reader object is an instance of GPathResult take a look at the following sample, assuming that your answer will be similar to the one you asked in your question:
http = new HTTPBuilder('http://www.MyYouTrackServer.com') http.get( path : '/MyIssue-25', contentType : 'application/xml' ) { resp, reader ->
Also in this YourTrack operation, it seems that there are two query parameters (project and max) to use it, you can add the query parameter to the get() method, that is: query : [ max : '15' ] .
Hope this helps,