Package org.jfree.data.json.impl
Class JSONObject
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap
org.jfree.data.json.impl.JSONObject
- All Implemented Interfaces:
Serializable
,Cloneable
,Map
,JSONAware
,JSONStreamAware
A JSON object. Key value pairs are unordered.
This class is for internal use by JFreeChart, it is not part of the supported API and you should not call it directly. If you need JSON support in your project you should include JSON.simple (https://code.google.com/p/json-simple/) or some other JSON library directly in your project.
This class is for internal use by JFreeChart, it is not part of the supported API and you should not call it directly. If you need JSON support in your project you should include JSON.simple (https://code.google.com/p/json-simple/) or some other JSON library directly in your project.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns a JSON string representing this object.static String
toJSONString
(Map map) Convert a map to JSON text.toString()
Returns a string representation of this object.static String
Returns a JSON string fragment containing the key and value.void
writeJSONString
(Writer out) Writes a JSON string representing this object instance to the specified output writer.static void
writeJSONString
(Map map, Writer out) 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, newHashMap, 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 Details
-
JSONObject
public JSONObject()
-
-
Method Details
-
writeJSONString
Encode a map into JSON text and write it to out. If this map is also aJSONAware
orJSONStreamAware
,JSONAware
orJSONStreamAware
specific behaviours will be ignored at this top level.- Parameters:
map
- the map to write (null
permitted).out
- the output writer (null
not permitted).- Throws:
IOException
- if there is an I/O problem.- See Also:
-
writeJSONString
Writes a JSON string representing this object instance to the specified output writer.- Specified by:
writeJSONString
in interfaceJSONStreamAware
- Parameters:
out
- the output writer (null
not permitted).- Throws:
IOException
- if there is an I/O problem.
-
toJSONString
Convert a map to JSON text. The result is a JSON object. If this map is also aJSONAware
,JSONAware
specific behaviours will be omitted at this top level.- Parameters:
map
- the map (null
permitted).- Returns:
- JSON text, or "null" if map is null.
- See Also:
-
toJSONString
Returns a JSON string representing this object.- Specified by:
toJSONString
in interfaceJSONAware
- Returns:
- A JSON string.
-
toString
Returns a string representation of this object.- Overrides:
toString
in classAbstractMap
- Returns:
- A string.
-
toString
Returns a JSON string fragment containing the key and value.- Parameters:
key
- the key (null
permitted).value
- the value (null
permitted).- Returns:
- A JSON string fragment.
-