Class JSONObject

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map, JSONAware, JSONStreamAware

    @Deprecated
    public class JSONObject
    extends java.util.HashMap
    implements java.util.Map, JSONAware, JSONStreamAware
    Deprecated.
    since 2.0.0, replaced by JsonObject
    A JSON object. Key value pairs are unordered. JSONObject supports java.util.Map interface.
    Author:
    FangYidong<fangyidong@yahoo.com.cn>
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Constructor Summary

      Constructors 
      Constructor Description
      JSONObject()
      Deprecated.
       
      JSONObject​(java.util.Map map)
      Deprecated.
      Allows creation of a JSONObject from a Map.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static java.lang.String escape​(java.lang.String s)
      Deprecated.
      Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters (U+0000 through U+001F).
      java.lang.String toJSONString()
      Deprecated.
       
      static java.lang.String toJSONString​(java.util.Map map)
      Deprecated.
      Convert a map to JSON text.
      java.lang.String toString()
      Deprecated.
       
      static java.lang.String toString​(java.lang.String key, java.lang.Object value)
      Deprecated.
      description omitted.
      void writeJSONString​(java.io.Writer out)
      Deprecated.
      write JSON string to out.
      static void writeJSONString​(java.util.Map map, java.io.Writer out)
      Deprecated.
      Encode a map into JSON text and write it to out.
      • Methods inherited from class java.util.HashMap

        clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
      • Methods inherited from class java.util.AbstractMap

        equals, hashCode
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
    • Constructor Detail

      • JSONObject

        public JSONObject()
        Deprecated.
      • JSONObject

        public JSONObject​(java.util.Map map)
        Deprecated.
        Allows creation of a JSONObject from a Map. After that, both the generated JSONObject and the Map can be modified independently.
        Parameters:
        map - description omitted.
    • Method Detail

      • writeJSONString

        public static void writeJSONString​(java.util.Map map,
                                           java.io.Writer out)
                                    throws java.io.IOException
        Deprecated.
        Encode a map into JSON text and write it to out. If this map is also a JSONAware or JSONStreamAware, JSONAware or JSONStreamAware specific behaviours will be ignored at this top level.
        Parameters:
        map - description omitted.
        out - description omitted.
        Throws:
        java.io.IOException - description omitted.
        See Also:
        JSONValue.writeJSONString(Object, Writer)
      • writeJSONString

        public void writeJSONString​(java.io.Writer out)
                             throws java.io.IOException
        Deprecated.
        Description copied from interface: JSONStreamAware
        write JSON string to out.
        Specified by:
        writeJSONString in interface JSONStreamAware
        Parameters:
        out - description omitted.
        Throws:
        java.io.IOException - description omitted.
      • toJSONString

        public static java.lang.String toJSONString​(java.util.Map map)
        Deprecated.
        Convert a map to JSON text. The result is a JSON object. If this map is also a JSONAware, JSONAware specific behaviours will be omitted at this top level.
        Parameters:
        map - description omitted.
        Returns:
        JSON text, or "null" if map is null.
        See Also:
        JSONValue.toJSONString(Object)
      • toJSONString

        public java.lang.String toJSONString()
        Deprecated.
        Specified by:
        toJSONString in interface JSONAware
        Returns:
        JSON text
      • toString

        public java.lang.String toString()
        Deprecated.
        Overrides:
        toString in class java.util.AbstractMap
      • toString

        public static java.lang.String toString​(java.lang.String key,
                                                java.lang.Object value)
        Deprecated.
        description omitted.
        Parameters:
        key - description omitted.
        value - description omitted.
        Returns:
        description omitted.
      • escape

        public static java.lang.String escape​(java.lang.String s)
        Deprecated.
        Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters (U+0000 through U+001F). It's the same as JSONValue.escape() only for compatibility here.
        Parameters:
        s - description omitted.
        Returns:
        description omitted.
        See Also:
        JSONValue.escape(String)