public class JSON extends Object
| Constructor and Description | 
|---|
| JSON() | 
| Modifier and Type | Method and Description | 
|---|---|
| static Object | parse(String jsonString)Parses a JSON string and returns a corresponding Java object. | 
| static Object | parse(String s,
     BSONCallback c)Parses a JSON string and constructs a corresponding Java object by calling the methods of a  BSONCallbackduring parsing. | 
| static String | serialize(Object object)Serializes an object into its JSON form. | 
| static void | serialize(Object object,
         StringBuilder buf)Serializes an object into its JSON form. | 
public static String serialize(Object object)
Serializes an object into its JSON form.
This method delegates serialization to JSONSerializers.getLegacy
object - object to serializeJSONSerializers.getLegacy()public static void serialize(Object object, StringBuilder buf)
Serializes an object into its JSON form.
This method delegates serialization to JSONSerializers.getLegacy
object - object to serializebuf - StringBuilder containing the JSON representation under constructionJSONSerializers.getLegacy()public static Object parse(String jsonString)
Parses a JSON string and returns a corresponding Java object. The returned value is either a DBObject
 (if the string is a JSON object or array), or a boxed primitive value according to the following mapping:
java.lang.Boolean for true or falsejava.lang.Integer for integers between Integer.MIN_VALUE and Integer.MAX_VALUEjava.lang.Long for integers outside of this rangejava.lang.Double for floating point numbersjava.lang.String. Parses a JSON string representing a JSON valuejsonString - the string to parseJSONParseException - if jsonString is not valid JSONpublic static Object parse(String s, BSONCallback c)
BSONCallback during parsing. If the callback c is null, this method is equivalent to parse(String).s - the string to parsec - the BSONCallback to call during parsingJSONParseException - if s is not valid JSON