net.minidev.json
public class JSONObject extends HashMap<String,Object> implements JSONAware, JSONAwareEx, JSONStreamAwareEx
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
JSONObject() |
JSONObject(Map<String,?> map)
Allows creation of a JSONObject from a Map.
|
Modifier and Type | Method and Description |
---|---|
static String |
escape(String s)
Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters
(U+0000 through U+001F).
|
Number |
getAsNumber(String key)
A Simple Helper cast an Object to an Number
|
String |
getAsString(String key)
A Simple Helper object to String
|
protected static JSONArray |
merge(JSONArray o1,
Object o2) |
protected static JSONObject |
merge(JSONObject o1,
Object o2) |
void |
merge(Object o2) |
String |
toJSONString() |
String |
toJSONString(JSONStyle compression) |
static String |
toJSONString(Map<String,? extends Object> map) |
static String |
toJSONString(Map<String,? extends Object> map,
JSONStyle compression)
Convert a map to JSON text.
|
String |
toString() |
String |
toString(JSONStyle compression) |
static void |
writeJSON(Map<String,? extends Object> map,
Appendable out) |
static void |
writeJSON(Map<String,? extends Object> map,
Appendable out,
JSONStyle compression)
Encode a map into JSON text and write it to out.
|
static void |
writeJSONKV(String key,
Object value,
Appendable out,
JSONStyle compression)
Write a Key : value entry to a stream
|
void |
writeJSONString(Appendable out)
serialize Object as json to an stream
|
void |
writeJSONString(Appendable out,
JSONStyle compression)
serialize Object as json to an stream
|
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
equals, hashCode
public static String escape(String s)
JSONValue.escape(String)
public static String toJSONString(Map<String,? extends Object> map, JSONStyle compression)
map
- JSONValue.toJSONString(Object)
public static void writeJSONKV(String key, Object value, Appendable out, JSONStyle compression) throws IOException
IOException
public String getAsString(String key)
public Number getAsNumber(String key)
public static void writeJSON(Map<String,? extends Object> map, Appendable out) throws IOException
IOException
public static void writeJSON(Map<String,? extends Object> map, Appendable out, JSONStyle compression) throws IOException
IOException
JSONValue.writeJSONString(Object, Appendable)
public void writeJSONString(Appendable out) throws IOException
writeJSONString
in interface JSONStreamAware
IOException
public void writeJSONString(Appendable out, JSONStyle compression) throws IOException
writeJSONString
in interface JSONStreamAwareEx
IOException
public void merge(Object o2)
protected static JSONObject merge(JSONObject o1, Object o2)
public String toJSONString()
toJSONString
in interface JSONAware
public String toJSONString(JSONStyle compression)
toJSONString
in interface JSONAwareEx
public String toString()
toString
in class AbstractMap<String,Object>
Copyright © 2014 Chemouni Uriel. All Rights Reserved.