Class JSON

    • Constructor Summary

      Constructors 
      Constructor Description
      JSON()
      Deprecated.
       
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static java.lang.Object parse​(java.lang.String jsonString)
      Deprecated.
      Parses a JSON string and returns a corresponding Java object.
      static java.lang.Object parse​(java.lang.String s, BSONCallback c)
      Deprecated.
      Parses a JSON string and constructs a corresponding Java object by calling the methods of a BSONCallback during parsing.
      static java.lang.String serialize​(java.lang.Object object)
      Deprecated.
      Serializes an object into its JSON form.
      static void serialize​(java.lang.Object object, java.lang.StringBuilder buf)
      Deprecated.
      Serializes an object into its JSON form.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JSON

        public JSON()
        Deprecated.
    • Method Detail

      • serialize

        public static java.lang.String serialize​(java.lang.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​(java.lang.Object object,
                                     java.lang.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 java.lang.Object parse​(java.lang.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 java.lang.Object parse​(java.lang.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