public class JSONValue extends 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 String |
compress(String input)
Compress Json input keeping element order
|
static String |
compress(String input,
JSONStyle style)
Reformat Json input keeping element order
|
static String |
escape(String s) |
static void |
escape(String s,
Appendable ap) |
static void |
escape(String s,
Appendable ap,
JSONStyle compression) |
static String |
escape(String s,
JSONStyle compression)
Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters
(U+0000 through U+001F).
|
static boolean |
isValidJson(Reader in)
Check Json Syntax from input Reader
|
static boolean |
isValidJson(String s)
Check Json Syntax from input String
|
static boolean |
isValidJsonStrict(Reader in)
Check RFC4627 Json Syntax from input Reader
|
static boolean |
isValidJsonStrict(String s)
check RFC4627 Json Syntax from input String
|
static Object |
parse(byte[] in)
Parse JSON text into java object from the input source.
|
static <T> T |
parse(byte[] in,
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 Object |
parse(InputStream in)
Parse JSON text into java object from the input source.
|
static <T> T |
parse(InputStream in,
Class<T> mapTo)
Parse input json as a mapTo class
mapTo can be a bean
|
static <T> T |
parse(InputStream in,
T toUpdate)
Parse input json as a mapTo class
mapTo can be a bean
|
static Object |
parse(Reader in)
Parse JSON text into java object from the input source.
|
static <T> T |
parse(Reader in,
Class<T> mapTo)
Parse input json as a mapTo class
mapTo can be a bean
|
protected static <T> T |
parse(Reader in,
JsonReaderI<T> mapper)
Parse input json as a mapTo class
|
static <T> T |
parse(Reader in,
T toUpdate)
Parse input json as a mapTo class
mapTo can be a bean
|
static Object |
parse(String s)
Parse JSON text into java object from the input source.
|
static <T> T |
parse(String in,
Class<T> mapTo)
Parse input json as a mapTo class
mapTo can be a bean
|
protected static <T> T |
parse(String in,
JsonReaderI<T> mapper)
Parse input json as a mapTo class
|
static <T> T |
parse(String in,
T toUpdate)
Parse input json as a mapTo class
mapTo can be a bean
|
static Object |
parseKeepingOrder(Reader in)
Parse Json input to a java Object keeping element order
|
static Object |
parseKeepingOrder(String in)
Parse Json input to a java Object keeping element order
|
static Object |
parseStrict(Reader in)
Parse valid RFC4627 JSON text into java object from the input source.
|
static Object |
parseStrict(String s)
Parse valid RFC4627 JSON text into java object from the input source.
|
static Object |
parseWithException(byte[] in)
Parse JSON text into java object from the input source.
|
static Object |
parseWithException(InputStream in)
Parse JSON text into java object from the input source.
|
static Object |
parseWithException(Reader in)
Parse JSON text into java object from the input source.
|
static Object |
parseWithException(String s)
Parse JSON text into java object from the input source.
|
static <T> T |
parseWithException(String in,
Class<T> mapTo)
Parse input json as a mapTo class
mapTo can be a bean
|
static <T> void |
registerReader(Class<T> type,
JsonReaderI<T> mapper)
register a deserializer for a class.
|
static <T> void |
registerWriter(Class<?> cls,
JsonWriterI<T> writer)
Register a serializer for a class.
|
static <T> void |
remapField(Class<T> type,
String jsonFieldName,
String javaFieldName)
remap field from java to json.
|
static String |
toJSONString(Object value)
Encode an object into JSON text and write it to out.
|
static String |
toJSONString(Object value,
JSONStyle compression)
Convert an object to JSON text.
|
static String |
uncompress(String input)
Compress Json input keeping element order
|
static void |
writeJSONString(Object value,
Appendable out)
Encode an object into JSON text and write it to out.
|
static void |
writeJSONString(Object value,
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 Object parse(InputStream in)
JSONParser.parse(Reader)
,
parseWithException(Reader)
public static Object parse(byte[] in)
JSONParser.parse(Reader)
,
parseWithException(Reader)
public static <T> T parse(InputStream in, Class<T> mapTo)
public static Object parse(Reader in)
JSONParser.parse(Reader)
,
parseWithException(Reader)
public static <T> T parse(byte[] in, Class<T> mapTo)
public static <T> T parse(Reader in, Class<T> mapTo)
public static <T> T parse(Reader in, T toUpdate)
protected static <T> T parse(Reader in, JsonReaderI<T> mapper)
public static <T> T parse(String in, Class<T> mapTo)
public static <T> T parse(InputStream in, T toUpdate)
public static <T> T parse(String in, T toUpdate)
protected static <T> T parse(byte[] in, JsonReaderI<T> mapper)
protected static <T> T parse(String in, JsonReaderI<T> mapper)
public static Object parse(String s)
JSONParser.parse(String)
,
parseWithException(String)
public static Object parseKeepingOrder(Reader in)
public static Object parseKeepingOrder(String in)
public static String compress(String input, JSONStyle style)
public static String compress(String input)
public static String uncompress(String input)
public static Object parseWithException(byte[] in) throws IOException, ParseException
IOException
ParseException
JSONParser
public static Object parseWithException(InputStream in) throws IOException, ParseException
IOException
ParseException
JSONParser
public static Object parseWithException(Reader in) throws IOException, ParseException
IOException
ParseException
JSONParser
public static Object parseWithException(String s) throws ParseException
ParseException
JSONParser
public static <T> T parseWithException(String in, Class<T> mapTo) throws ParseException
ParseException
public static Object parseStrict(Reader in) throws IOException, ParseException
IOException
ParseException
JSONParser
public static Object parseStrict(String s) throws ParseException
ParseException
JSONParser
public static boolean isValidJsonStrict(Reader in) throws IOException
IOException
public static boolean isValidJsonStrict(String s)
public static boolean isValidJson(Reader in) throws IOException
IOException
public static boolean isValidJson(String s)
public static void writeJSONString(Object value, Appendable 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.
public static <T> void remapField(Class<T> type, String jsonFieldName, String javaFieldName)
public static <T> void registerWriter(Class<?> cls, JsonWriterI<T> writer)
public static <T> void registerReader(Class<T> type, JsonReaderI<T> mapper)
public static void writeJSONString(Object value, Appendable out, JSONStyle compression) 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.
public static String toJSONString(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 String toJSONString(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 String escape(String s, JSONStyle compression)
public static void escape(String s, Appendable ap)
public static void escape(String s, Appendable ap, JSONStyle compression)
Copyright © 2015 Chemouni Uriel. All rights reserved.