Package org.zkoss.json

## Class JSONObject

- java.lang.Object
- - java.util.AbstractMap<K,​V>
  - - java.util.HashMap<K,​V>
    - - java.util.LinkedHashMap<java.lang.Object,​java.lang.Object>
      - - org.zkoss.json.JSONObject

- All Implemented Interfaces:
    `java.io.Serializable`, `java.lang.Cloneable`, `java.util.Map<java.lang.Object,​java.lang.Object>`, `JSONAware`

      public class JSONObject
      extends java.util.LinkedHashMap<java.lang.Object,​java.lang.Object>
      implements java.util.Map<java.lang.Object,​java.lang.Object>, JSONAware

  A JSON object. Key value pairs are in the order of adding. 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()` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.String` | `toJSONString()` | Encodes this object to a JSON string.
    `static java.lang.String` | `toJSONString​(java.util.Map map)` | Convert (aka., encode) a map to JSON text.
    `java.lang.String` | `toString()` | Encodes this object to a JSON string.
    `static java.lang.String` | `toString​(java.lang.String key, java.lang.Object value)` |

    - ### Methods inherited from class java.util.LinkedHashMap

      `clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values`

    - ### Methods inherited from class java.util.HashMap

      `clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size`

    - ### 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()

  - ### Method Detail

    - #### toJSONString

          public static java.lang.String toJSONString​(java.util.Map map)

      Convert (aka., encode) a map to JSON text. The result is a JSON object. If this map is also a JSONAware, JSONAware specific behaviors will be omitted at this top level.
      Parameters:
        `map` -
      Returns:
        JSON text, or "null" if map is null.
      See Also:
        `JSONValue.toJSONString(Object)`

    - #### toJSONString

          public java.lang.String toJSONString()

      Encodes this object to a JSON string. It is the same as `toString()`.
      Specified by:
        `toJSONString` in interface `JSONAware`
      Returns:
        JSON text

    - #### toString

          public java.lang.String toString()

      Encodes this object to a JSON string. It is the same as `toJSONString()`.
      Overrides:
        `toString` in class `java.util.AbstractMap<java.lang.Object,​java.lang.Object>`

    - #### toString

          public static java.lang.String toString​(java.lang.String key,
                                                  java.lang.Object value)