Class JSONObject

    • Constructor Detail

      • JSONObject

        public JSONObject()
      • JSONObject

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

      • writeJSONString

        public static void writeJSONString​(Map map,
                                           Writer out)
                                    throws IOException
        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 -
        out -
        Throws:
        IOException
        See Also:
        JSONValue.writeJSONString(Object, Writer)
      • toJSONString

        public static String toJSONString​(Map map)
        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 -
        Returns:
        JSON text, or "null" if map is null.
        See Also:
        JSONValue.toJSONString(Object)
      • escape

        public static String escape​(String s)
        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 -
        Returns:
        See Also:
        JSONValue.escape(String)