Parse Jazz REST API Output
One answer
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.
https://developer.mozilla.org/en-US/docs/Web/Guide/Parsing_and_serializing_XML
https://developer.mozilla.org/en-US/docs/How_to_create_a_DOM_tree
http://www.perlmonks.org/?node_id=1075675
http://www.perlrdf.org/
Comments
Donald Nong
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
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")