Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Parse Jazz REST API Output

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.

0 votes

Comments

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.

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
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/

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,936
× 7,494
× 478

Question asked: Apr 21 '15, 6:50 p.m.

Question was seen: 4,839 times

Last updated: Apr 22 '15, 5:02 a.m.

Confirmation Cancel Confirm