Converting Json to Java

Posted by Binaryrespawn on Stack Overflow See other posts from Stack Overflow or by Binaryrespawn
Published on 2009-11-06T14:54:04Z Indexed on 2010/04/23 21:43 UTC
Read the original article Hit count: 359

Filed under:
|

Hi all, I want to be able to access properties from a json string within my java action method. The string is available by simply saying myJsonString = object.getJson(); Below is an example of what the string can look like:

{'title': 'Computing and Information systems','id':1,'children': 'true','groups':
  [{'title': 'Level one CIS','id':2,'children': 'true','groups':[{'title': 'Intro To 
 Computing and Internet','id':3,'children': 'false','groups':[]}]}]}

In this string every json object contains an array of other json objects. The intention is to extract a list of id's where any given object possessing a group property that contains other json objects. I looked at google's Gson as a potential json plugin. Can anyone offer some form of guidance as to how I can generate java from this json string?

Thank you, Kind regards.

© Stack Overflow or respective owner

Related posts about JSON

Related posts about java