Hi,
I have a JSON string that I read in and would like to parse / map it to a JavaBean so I can use it in my Java code. What is the easiest way / library to achieve this?
Hi,
I have a JSON string that I read in and would like to parse / map it to a JavaBean so I can use it in my Java code. What is the easiest way / library to achieve this?
I wrote a JSON library to do just that..
http://code.google.com/p/svenson/
With svenson you would do something like:
// assume json to be a JSON dataset as String
MyBean bean = JSONParser.defaultJSONParser().parse(MyBean.class, json);
Svenson gives you free choice of either using maps/lists or your own POJOs to convert data to and from JSON.