public final class JSONValue extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
addJSONString(Object value,
StringBuilder sb)
Converts an object to JSON text and attach it the the given
StringBuilder.
|
static String |
escape(String s)
Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters
(U+0000 through U+001F).
|
static Object |
parse(Reader in)
Parse JSON text into java object from the input source.
|
static Object |
parse(String s) |
static Object |
parseWithException(Reader in)
Parse JSON text into java object from the input source.
|
static Object |
parseWithException(String s) |
static String |
toJSONString(Object value)
Converts an object to JSON text.
|
static void |
writeJSONString(Object value,
Writer out)
Encode an object into JSON text and write it to out.
|
public static Object parse(Reader in)
in - JSONParser.parse(Reader),
parseWithException(Reader)public static Object parseWithException(Reader in) throws IOException, JSONParseException
in - IOExceptionJSONParseExceptionJSONParserpublic static Object parseWithException(String s) throws JSONParseException
JSONParseExceptionpublic static void writeJSONString(Object value, Writer out) throws IOException
If this object is a Map or a List, and it's also a JSONStreamAware or a JSONAware, JSONStreamAware or JSONAware 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.
value - out - IOExceptionJSONObject.writeJSONString(Map,
Writer),
JSONArray.writeJSONString(List,
Writer)public static String toJSONString(Object value)
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.
value - JSONObject.toJSONString(Map),
JSONArray.toJSONString(List)public static void addJSONString(Object value, StringBuilder sb)
toJSONString(Object)Copyright © 2009–2017 The Apache Software Foundation. All rights reserved.