[json-lib-user] Converting JSON strings to Java Maps
Brought to you by:
aalmiray
From: Florian S. <flo...@gm...> - 2007-05-28 15:40:13
|
Hi all, I have a question regarding the conversion of JSON string into Java objects. Please bare with me, as I have already read json-lib's documentation, without being able to find answers to all of my questions. Consider the following JSON string: {"comments": {"file1.java" : [{ "pos_start": 34, "pos_end": 45}], "file2.java" : [{ "pos_start": 56, "pos_end": 78}] }} I need to convert this string into a Java object. Ideally, I would like to obtain an object of the class public class MyBean{ private Map<String, List<Map<String, Integer>>> comments; //getters & setters } Any advice on how I could do that? If not, can I avoid specifying a bean class with fields "file1.java" and "file2.java" ? Thanks in advance, Florian |