Class JSON

    • Constructor Detail

      • JSON

        public JSON()
        Deprecated.
    • 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 serialize
        buf - 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 for true or false
        • java.lang.Integer for integers between Integer.MIN_VALUE and Integer.MAX_VALUE
        • java.lang.Long for integers outside of this range
        • java.lang.Double for floating point numbers
        If the parameter is a string that contains a single-quoted or double-quoted string, it is returned as an unquoted 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 a BSONCallback during parsing. If the callback c is null, this method is equivalent to parse(String).
        Parameters:
        s - the string to parse
        c - the BSONCallback to call during parsing
        Returns:
        a Java object representing the JSON data
        Throws:
        JSONParseException - if s is not valid JSON