It's all about the answers!

Ask a question

Parse Jazz REST API Output

Grace Gao (111) | asked Apr 21 '15, 6:50 p.m.
I have tried to use RTC RESTAPI for some administrative tasks. It's fairly simple to get xml output. However I have not found a working parser to push the output in JSON or an easy to use hash. I try to avoid parsing with regular expression. Any suggestions? Thanks.

Donald Nong commented Apr 21 '15, 7:25 p.m.

Can you make it more specific? Which API are you trying to use and what output do you expect? Some APIs can respond with JSON output if you put the "Accept: application/json" HTTP header in the request.

Grace Gao commented Apr 21 '15, 7:55 p.m.

Thanks for the quick response Donald. I use LWP::UserAgent. One example of get statement is like below:
$Response = $Browser->get( "$JazzURI" . "/process/project-areas")

One answer

permanent link
Donald Nong (14.5k614) | answered Apr 21 '15, 8:50 p.m.
This particular URI does return XML content only. I'm not quite sure why you cannot find a working parser in Perl as there are quite many to choose from. I'm not quite sure why you want to make it into JSON either. To do what you want, generally speaking, you need to parse the XML content in the stream (HTTP response), get a DOM tree, then serialize it into JSON format. You will need both XML and JSON modules to do so. I have no real experience on these Perl modules so can't make recommendations as such. The below links should get you started though.

Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.