With this Library, you can easily parse a Json String to an Java Object.
All you have to do is:
JsonObject expression = JsonSimple.parse("{\"key\" : \"value\"}");
String value = expression.get("key"); //returns a String
Like this you can parse any Json String you have. In the folowing are some examples.
JsonObject expression = JsonSimple.parse("{\"int\" : 42, \"double\" : 4e-2}");
Integer theAnswer = expression.get("int"); //returns an Integer Object
Double number = expression.get("double"); //returns an Double Object
JsonSimple understands any Integer or Double Values signed or unsigned with exponent or without, try it by yourself ;)
JsonObject expression = JsonSimple.parse("{\"bool\" : true}");
Boolean bool = expression.get("bool"); //returns an Boolean Object
JsonObject expression = JsonSimple.parse("{\"outer\":{\"inner\":\"value\"}}");
String value = ((Map)expression.get("outer")).get("inner"); //the inner Object works the same
If you parse an Object, you get a Map as the inner Object, which held all the inner values.
JsonObject expression = JsonSimple.parse("{\"array\" : [\"value\", \"value2\" ] }");
List<String> list = expression.get("array"); //returns a List
If you parse an Array, you get a List, but i think thats more kind of a improvement ;)
If you parse more complex Objects you will be returned nested Maps and Lists like above.