Package org.jfree.data.json.impl
Class JSONValue
java.lang.Object
org.jfree.data.json.impl.JSONValue
Utility methods for JSON values.
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.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters (U+0000 through U+001F).static String
toJSONString
(Object value) Convert an object to JSON text.static void
writeJSONString
(Object value, Writer out) Encode an object into JSON text and write it to out.
-
Constructor Details
-
JSONValue
public JSONValue()
-
-
Method Details
-
writeJSONString
Encode an object into JSON text and write it to out.If this object is a
Map
or aList
, and it's also aJSONStreamAware
or aJSONAware
,JSONStreamAware
orJSONAware
will be considered firstly.DO NOT call this method from writeJSONString(Writer) of a class that implements both JSONStreamAware and (Map or List) with "this" as the first parameter, use JSONObject.writeJSONString(Map, Writer) or JSONArray.writeJSONString(List, Writer) instead.
- Parameters:
value
- the value.out
- the output writer.- Throws:
IOException
- if there is an I/O problem.- See Also:
-
toJSONString
Convert an object to JSON text.If this object is a Map or a List, and it's also a JSONAware, JSONAware will be considered firstly.
DO NOT call this method from toJSONString() of a class that implements both JSONAware and Map or List with "this" as the parameter, use JSONObject.toJSONString(Map) or JSONArray.toJSONString(List) instead.
- Parameters:
value
- the value.- Returns:
- JSON text, or "null" if value is null or it's an NaN or an INF number.
- See Also:
-
escape
Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters (U+0000 through U+001F).- Parameters:
s
- the string to be escaped (null
permitted).- Returns:
- A string.
-