Package com.mongodb.util
Class JSON
- java.lang.Object
-
- com.mongodb.util.JSON
-
@Deprecated public class JSON extends Object
Deprecated.This class has been superseded by to toJson and parse methods on BasicDBObjectHelper methods for JSON serialization and de-serialization
-
-
Constructor Summary
Constructors Constructor Description JSON()
Deprecated.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Object
parse(String jsonString)
Deprecated.Parses a JSON string and returns a corresponding Java object.static Object
parse(String s, BSONCallback c)
Deprecated.Parses a JSON string and constructs a corresponding Java object by calling the methods of aBSONCallback
during parsing.static String
serialize(Object object)
Deprecated.Serializes an object into its JSON form.static void
serialize(Object object, StringBuilder buf)
Deprecated.Serializes an object into its JSON form.
-
-
-
Method Detail
-
serialize
public static String serialize(Object object)
Deprecated.Serializes an object into its JSON form.
This method delegates serialization to
JSONSerializers.getLegacy
- Parameters:
object
- object to serialize- Returns:
- String containing JSON form of the object
- See Also:
JSONSerializers.getLegacy()
-
serialize
public static void serialize(Object object, StringBuilder buf)
Deprecated.Serializes an object into its JSON form.
This method delegates serialization to
JSONSerializers.getLegacy
- Parameters:
object
- object to serializebuf
- StringBuilder containing the JSON representation under construction- See Also:
JSONSerializers.getLegacy()
-
parse
public static Object parse(String jsonString)
Deprecated.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
fortrue
orfalse
java.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 numbers
java.lang.String
. Parses a JSON string representing a JSON value- Parameters:
jsonString
- the string to parse- Returns:
- a Java object representing the JSON data
- Throws:
JSONParseException
- if jsonString is not valid JSON
-
parse
public static Object parse(String s, BSONCallback c)
Deprecated.Parses a JSON string and constructs a corresponding Java object by calling the methods of aBSONCallback
during parsing. If the callbackc
is null, this method is equivalent toparse(String)
.- Parameters:
s
- the string to parsec
- the BSONCallback to call during parsing- Returns:
- a Java object representing the JSON data
- Throws:
JSONParseException
- if s is not valid JSON
-
-