public class JSONValue
extends java.lang.Object
parse(String)
toJSONString(Object)| Modifier and Type | Field and Description |
|---|---|
static JSONStyle |
COMPRESSION
Global default compression type
|
static JsonReader |
defaultReader
deserialisation class Data
|
static JsonWriter |
defaultWriter
Serialisation class Data
|
| Constructor and Description |
|---|
JSONValue() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
compress(java.lang.String input)
Compress Json input keeping element order
|
static java.lang.String |
compress(java.lang.String input,
JSONStyle style)
Reformat Json input keeping element order
|
static java.lang.String |
escape(java.lang.String s) |
static void |
escape(java.lang.String s,
java.lang.Appendable ap) |
static void |
escape(java.lang.String s,
java.lang.Appendable ap,
JSONStyle compression) |
static java.lang.String |
escape(java.lang.String s,
JSONStyle compression)
Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters
(U+0000 through U+001F).
|
static boolean |
isValidJson(java.io.Reader in)
Check Json Syntax from input Reader
|
static boolean |
isValidJson(java.lang.String s)
Check Json Syntax from input String
|
static boolean |
isValidJsonStrict(java.io.Reader in)
Check RFC4627 Json Syntax from input Reader
|
static boolean |
isValidJsonStrict(java.lang.String s)
check RFC4627 Json Syntax from input String
|
static java.lang.Object |
parse(byte[] in)
Parse JSON text into java object from the input source.
|
static <T> T |
parse(byte[] in,
java.lang.Class<T> mapTo)
Parse input json as a mapTo class
mapTo can be a bean
|
protected static <T> T |
parse(byte[] in,
JsonReaderI<T> mapper)
Parse input json as a mapTo class
|
static java.lang.Object |
parse(java.io.InputStream in)
Parse JSON text into java object from the input source.
|
static <T> T |
parse(java.io.InputStream in,
java.lang.Class<T> mapTo)
Parse input json as a mapTo class
mapTo can be a bean
|
static <T> T |
parse(java.io.InputStream in,
T toUpdate)
Parse input json as a mapTo class
mapTo can be a bean
|
static java.lang.Object |
parse(java.io.Reader in)
Parse JSON text into java object from the input source.
|
static <T> T |
parse(java.io.Reader in,
java.lang.Class<T> mapTo)
Parse input json as a mapTo class
mapTo can be a bean
|
protected static <T> T |
parse(java.io.Reader in,
JsonReaderI<T> mapper)
Parse input json as a mapTo class
|
static <T> T |
parse(java.io.Reader in,
T toUpdate)
Parse input json as a mapTo class
mapTo can be a bean
|
static java.lang.Object |
parse(java.lang.String s)
Parse JSON text into java object from the input source.
|
static <T> T |
parse(java.lang.String in,
java.lang.Class<T> mapTo)
Parse input json as a mapTo class
mapTo can be a bean
|
protected static <T> T |
parse(java.lang.String in,
JsonReaderI<T> mapper)
Parse input json as a mapTo class
|
static <T> T |
parse(java.lang.String in,
T toUpdate)
Parse input json as a mapTo class
mapTo can be a bean
|
static java.lang.Object |
parseKeepingOrder(java.io.Reader in)
Parse Json input to a java Object keeping element order
|
static java.lang.Object |
parseKeepingOrder(java.lang.String in)
Parse Json input to a java Object keeping element order
|
static java.lang.Object |
parseStrict(java.io.Reader in)
Parse valid RFC4627 JSON text into java object from the input source.
|
static java.lang.Object |
parseStrict(java.lang.String s)
Parse valid RFC4627 JSON text into java object from the input source.
|
static java.lang.Object |
parseWithException(byte[] in)
Parse JSON text into java object from the input source.
|
static java.lang.Object |
parseWithException(java.io.InputStream in)
Parse JSON text into java object from the input source.
|
static java.lang.Object |
parseWithException(java.io.Reader in)
Parse JSON text into java object from the input source.
|
static java.lang.Object |
parseWithException(java.lang.String s)
Parse JSON text into java object from the input source.
|
static <T> T |
parseWithException(java.lang.String in,
java.lang.Class<T> mapTo)
Parse input json as a mapTo class
mapTo can be a bean
|
static <T> void |
registerReader(java.lang.Class<T> type,
JsonReaderI<T> mapper)
register a deserializer for a class.
|
static <T> void |
registerWriter(java.lang.Class<?> cls,
JsonWriterI<T> writer)
Register a serializer for a class.
|
static <T> void |
remapField(java.lang.Class<T> type,
java.lang.String jsonFieldName,
java.lang.String javaFieldName)
remap field from java to json.
|
static java.lang.String |
toJSONString(java.lang.Object value)
Encode an object into JSON text and write it to out.
|
static java.lang.String |
toJSONString(java.lang.Object value,
JSONStyle compression)
Convert an object to JSON text.
|
static java.lang.String |
uncompress(java.lang.String input)
Compress Json input keeping element order
|
static void |
writeJSONString(java.lang.Object value,
java.lang.Appendable out)
Encode an object into JSON text and write it to out.
|
static void |
writeJSONString(java.lang.Object value,
java.lang.Appendable out,
JSONStyle compression)
Encode an object into JSON text and write it to out.
|
public static JSONStyle COMPRESSION
public static final JsonWriter defaultWriter
public static final JsonReader defaultReader
public static java.lang.Object parse(java.io.InputStream in)
JSONParser.parse(Reader),
parseWithException(Reader)public static java.lang.Object parse(byte[] in)
JSONParser.parse(Reader),
parseWithException(Reader)public static <T> T parse(java.io.InputStream in,
java.lang.Class<T> mapTo)
public static java.lang.Object parse(java.io.Reader in)
JSONParser.parse(Reader),
parseWithException(Reader)public static <T> T parse(byte[] in,
java.lang.Class<T> mapTo)
public static <T> T parse(java.io.Reader in,
java.lang.Class<T> mapTo)
public static <T> T parse(java.io.Reader in,
T toUpdate)
protected static <T> T parse(java.io.Reader in,
JsonReaderI<T> mapper)
public static <T> T parse(java.lang.String in,
java.lang.Class<T> mapTo)
public static <T> T parse(java.io.InputStream in,
T toUpdate)
public static <T> T parse(java.lang.String in,
T toUpdate)
protected static <T> T parse(byte[] in,
JsonReaderI<T> mapper)
protected static <T> T parse(java.lang.String in,
JsonReaderI<T> mapper)
public static java.lang.Object parse(java.lang.String s)
JSONParser.parse(String),
parseWithException(String)public static java.lang.Object parseKeepingOrder(java.io.Reader in)
public static java.lang.Object parseKeepingOrder(java.lang.String in)
public static java.lang.String compress(java.lang.String input,
JSONStyle style)
public static java.lang.String compress(java.lang.String input)
public static java.lang.String uncompress(java.lang.String input)
public static java.lang.Object parseWithException(byte[] in)
throws java.io.IOException,
ParseException
java.io.IOExceptionParseExceptionJSONParserpublic static java.lang.Object parseWithException(java.io.InputStream in)
throws java.io.IOException,
ParseException
java.io.IOExceptionParseExceptionJSONParserpublic static java.lang.Object parseWithException(java.io.Reader in)
throws java.io.IOException,
ParseException
java.io.IOExceptionParseExceptionJSONParserpublic static java.lang.Object parseWithException(java.lang.String s)
throws ParseException
ParseExceptionJSONParserpublic static <T> T parseWithException(java.lang.String in,
java.lang.Class<T> mapTo)
throws ParseException
ParseExceptionpublic static java.lang.Object parseStrict(java.io.Reader in)
throws java.io.IOException,
ParseException
java.io.IOExceptionParseExceptionJSONParserpublic static java.lang.Object parseStrict(java.lang.String s)
throws ParseException
ParseExceptionJSONParserpublic static boolean isValidJsonStrict(java.io.Reader in)
throws java.io.IOException
java.io.IOExceptionpublic static boolean isValidJsonStrict(java.lang.String s)
public static boolean isValidJson(java.io.Reader in)
throws java.io.IOException
java.io.IOExceptionpublic static boolean isValidJson(java.lang.String s)
public static void writeJSONString(java.lang.Object value,
java.lang.Appendable out)
throws java.io.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.
java.io.IOExceptionJSONObject.writeJSON(Map, Appendable),
JSONArray.writeJSONString(List, Appendable)public static <T> void remapField(java.lang.Class<T> type,
java.lang.String jsonFieldName,
java.lang.String javaFieldName)
public static <T> void registerWriter(java.lang.Class<?> cls,
JsonWriterI<T> writer)
public static <T> void registerReader(java.lang.Class<T> type,
JsonReaderI<T> mapper)
public static void writeJSONString(java.lang.Object value,
java.lang.Appendable out,
JSONStyle compression)
throws java.io.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.
java.io.IOExceptionJSONObject.writeJSON(Map, Appendable),
JSONArray.writeJSONString(List, Appendable)public static java.lang.String toJSONString(java.lang.Object value)
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.
public static java.lang.String toJSONString(java.lang.Object value,
JSONStyle compression)
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.
JSONObject.toJSONString(Map),
JSONArray.toJSONString(List)public static java.lang.String escape(java.lang.String s)
public static java.lang.String escape(java.lang.String s,
JSONStyle compression)
public static void escape(java.lang.String s,
java.lang.Appendable ap)
public static void escape(java.lang.String s,
java.lang.Appendable ap,
JSONStyle compression)