JSON Parser and Generator.
This class provides some static methods to convert POJOs to and from JSON
notation. The mapping from JSON to java is:
object ==> Map
array ==> Object[]
number ==> Double or Long
string ==> String
null ==> null
bool ==> Boolean
The java to JSON mapping is:
String --> string
Number --> number
Map --> object
List --> array
Array --> array
null --> null
Boolean--> boolean
Object --> string (dubious!)
The interface
JSON.Generator may be implemented by classes that know how to render themselves as JSON and
the
JSON.toString(Object) method will use
JSON.Generator.addJSON(StringBuffer) to generate the JSON.
The class
JSON.Literal may be used to hold pre-gnerated JSON object.
author: gregw |