Package com.mongodb.util
Class JSON
java.lang.Object
com.mongodb.util.JSON
Deprecated.
This class has been superseded by to toJson and parse methods on BasicDBObject
Helper methods for JSON serialization and de-serialization
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Object
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
Deprecated.Serializes an object into its JSON form.static void
serialize
(Object object, StringBuilder buf) Deprecated.Serializes an object into its JSON form.
-
Constructor Details
-
JSON
public JSON()Deprecated.
-
-
Method Details
-
serialize
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:
-
serialize
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:
-
parse
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
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
-