Class JSONKt
-
- All Implemented Interfaces:
public final class JSONKt
-
-
Method Summary
Modifier and Type Method Description final static <T extends Any> Tto(String $self)Parses the json string as TE.g. final static <T extends Any> Tto(ByteArray $self)Parses the json byte array as TE.g. final static <T extends Any> Tto(URL $self, JSONReader.Feature features)Parses the json stream as T with the specified featuresE.g. final static <T extends Any> Tto(InputStream $self, JSONReader.Feature features)Parses the json stream as T with the specified featuresE.g. final static <T extends Any> Tinto(String $self)Parses the json string as T Implemented using TypeReferenceE.g. final static <T extends Any> Tinto(ByteArray $self)Parses the json byte array as T Implemented using TypeReferenceE.g. final static <T extends Any> Tinto(URL $self, JSONReader.Feature features)Parses the json stream as T with the specified featuresE.g. final static <T extends Any> Tinto(InputStream $self, JSONReader.Feature features)Parses the json stream as T with the specified featuresE.g. final static BooleanisJSONObject(String $self)Verify that the json string is a JsonObjectE.g. final static BooleanisJSONObject(ByteArray $self)Verify that the json byte array is a JsonObjectE.g. final static BooleanisJSONArray(String $self)Verify that the json string is a JsonArrayE.g. final static BooleanisJSONArray(ByteArray $self)Verify that the json byte array is a JsonArrayE.g. final static JSONObjectparseObject(String $self)Parses the json string as JSONObjectE.g. final static JSONObjectparseObject(ByteArray $self)Parses the json byte array as JSONObjectE.g. final static JSONObjectparseObject(String $self, JSONReader.Feature features)Parses the json string as JSONObject with the specified features final static JSONObjectparseObject(ByteArray $self, JSONReader.Feature features)Parses the json byte array as JSONObject with the specified features final static JSONObjectparseObject(Reader $self, JSONReader.Feature features)Parses the json reader as JSONObject with the specified features final static JSONObjectparseObject(InputStream $self, JSONReader.Feature features)Parses the json stream as JSONObject with the specified features final static <T extends Any> TparseObject(String $self)Parses the json string as T final static <T extends Any> TparseObject(String $self, JSONReader.Feature features)Parses the json string as T with the specified features final static <T extends Any> TparseObject(String $self, Filter filter, JSONReader.Feature features)Parses the json string as T with the specified filter and features final static <T extends Any> TparseObject(ByteArray $self)Parses the json byte array as T final static <T extends Any> TparseObject(ByteArray $self, JSONReader.Feature features)Parses the json byte array as T with the specified features final static <T extends Any> TparseObject(ByteArray $self, Filter filter, JSONReader.Feature features)Parses the json byte array as T with the specified filter and features final static <T extends Any> TparseObject(ByteArray $self, Integer offset, Integer length, Charset charset)Parses the json byte array as T with the specified offset, length and charset final static <T extends Any> UnitparseObject(Reader $self, Character delimiter, Function1<T, Unit> consumer)Parses the json reader as T with the specified delimiter and consumerE.g. final static <T extends Any> UnitparseObject(InputStream $self, JSONReader.Feature features, Function1<T, Unit> consumer)Parses the json stream as T with the specified features and consumerE.g. final static <T extends Any> UnitparseObject(InputStream $self, Charset charset, Character delimiter, JSONReader.Feature features, Function1<T, Unit> consumer)Parses the json stream as T with the specified charset and features and so onE.g. final static JSONArrayparseArray(String $self)Parses the json string as JSONArrayE.g. final static <T extends Any> List<T>parseArray(String $self)Parses the json string as a list of TE.g. final static <T extends Any> List<T>parseArray(String $self, JSONReader.Feature features)Parses the json string as a list of T with the specified features final static <T extends Any> List<T>parseArray(ByteArray $self, JSONReader.Feature features)Parses the json byte array as a list of T with the specified features final static StringtoJSONString(Object $self)Serializes this object to the json stringE.g. final static StringtoJSONString(Object $self, Array<out Filter> filters)Serializes this object to the json string with the specified filters final static StringtoJSONString(Object $self, JSONWriter.Feature features)Serializes this object to the json string with the specified features final static StringtoJSONString(Object $self, Filter filter, JSONWriter.Feature features)Serializes this object to the json string with the specified filter and features final static StringtoJSONString(Object $self, Array<out Filter> filters, JSONWriter.Feature features)Serializes this object to the json string with the specified filters and features final static ByteArraytoJSONByteArray(Object $self)Serializes this object to the json byte arrayE.g. final static ByteArraytoJSONByteArray(Object $self, Array<out Filter> filters)Serializes this object to the json byte array with the specified filters final static ByteArraytoJSONByteArray(Object $self, JSONWriter.Feature features)Serializes this object to the json byte array with the specified features final static ByteArraytoJSONByteArray(Object $self, Array<out Filter> filters, JSONWriter.Feature features)Serializes this object to the json byte array with the specified filters and features -
-
Method Detail
-
to
final static <T extends Any> T to(String $self)
Parses the json string as T
E.g.
val json = ... val data = json.to<User>()- Returns:
T?
- Since:
2.0.3
-
to
final static <T extends Any> T to(ByteArray $self)
Parses the json byte array as T
E.g.
val json = ... val data = json.to<User>()- Returns:
T?
- Since:
2.0.3
-
to
final static <T extends Any> T to(URL $self, JSONReader.Feature features)
Parses the json stream as T with the specified features
E.g.
val url = ... val data = url.to<User>()- Parameters:
features- the specified features is applied to parsing- Returns:
T?
- Since:
2.0.30
-
to
final static <T extends Any> T to(InputStream $self, JSONReader.Feature features)
Parses the json stream as T with the specified features
E.g.
val in = ... val data = in.to<User>()- Parameters:
features- the specified features is applied to parsing- Returns:
T?
- Since:
2.0.4
-
into
final static <T extends Any> T into(String $self)
Parses the json string as T Implemented using TypeReference
E.g.
val json = ... val data = json.into<Map<String, User>>()- Returns:
T?
- Since:
2.0.3
-
into
final static <T extends Any> T into(ByteArray $self)
Parses the json byte array as T Implemented using TypeReference
E.g.
val json = ... val data = json.into<Map<String, User>>()- Returns:
T?
- Since:
2.0.3
-
into
final static <T extends Any> T into(URL $self, JSONReader.Feature features)
Parses the json stream as T with the specified features
E.g.
val url = ... val data = url.into<Map<String, User>>()- Parameters:
features- the specified features is applied to parsing- Returns:
T?
- Since:
2.0.4
-
into
final static <T extends Any> T into(InputStream $self, JSONReader.Feature features)
Parses the json stream as T with the specified features
E.g.
val in = ... val data = in.into<Map<String, User>>()- Parameters:
features- the specified features is applied to parsing- Returns:
T?
- Since:
2.0.4
-
isJSONObject
final static Boolean isJSONObject(String $self)
Verify that the json string is a JsonObject
E.g.
val json = ... val bool = json.isJSONObject()- Since:
2.0.3
-
isJSONObject
final static Boolean isJSONObject(ByteArray $self)
Verify that the json byte array is a JsonObject
E.g.
val json = ... val bool = json.isJSONObject()- Since:
2.0.3
-
isJSONArray
final static Boolean isJSONArray(String $self)
Verify that the json string is a JsonArray
E.g.
val json = ... val bool = json.isJSONArray()- Since:
2.0.3
-
isJSONArray
final static Boolean isJSONArray(ByteArray $self)
Verify that the json byte array is a JsonArray
E.g.
val json = ... val bool = json.isJSONArray()- Since:
2.0.3
-
parseObject
final static JSONObject parseObject(String $self)
Parses the json string as JSONObject
E.g.
val json = ... val data = json.parseObject()- Returns:
JSONObject?
- Since:
2.0.3
-
parseObject
final static JSONObject parseObject(ByteArray $self)
Parses the json byte array as JSONObject
E.g.
val json = ... val data = json.parseObject()- Returns:
JSONObject?
- Since:
2.0.4
-
parseObject
final static JSONObject parseObject(String $self, JSONReader.Feature features)
Parses the json string as JSONObject with the specified features
- Parameters:
features- the specified features is applied to parsing- Returns:
JSONObject?
- Since:
2.0.4
-
parseObject
final static JSONObject parseObject(ByteArray $self, JSONReader.Feature features)
Parses the json byte array as JSONObject with the specified features
- Parameters:
features- the specified features is applied to parsing- Returns:
JSONObject?
- Since:
2.0.4
-
parseObject
final static JSONObject parseObject(Reader $self, JSONReader.Feature features)
Parses the json reader as JSONObject with the specified features
- Parameters:
features- the specified features is applied to parsing- Returns:
JSONObject?
- Since:
2.0.30
-
parseObject
final static JSONObject parseObject(InputStream $self, JSONReader.Feature features)
Parses the json stream as JSONObject with the specified features
- Parameters:
features- the specified features is applied to parsing- Returns:
JSONObject?
- Since:
2.0.4
-
parseObject
final static <T extends Any> T parseObject(String $self)
Parses the json string as T
- Returns:
T?
- Since:
2.0.3
-
parseObject
final static <T extends Any> T parseObject(String $self, JSONReader.Feature features)
Parses the json string as T with the specified features
- Parameters:
features- the specified features is applied to parsing- Returns:
T?
- Since:
2.0.3
-
parseObject
final static <T extends Any> T parseObject(String $self, Filter filter, JSONReader.Feature features)
Parses the json string as T with the specified filter and features
- Parameters:
filter- the specified filter is applied to parsingfeatures- the specified features is applied to parsing- Returns:
T?
- Since:
2.0.3
-
parseObject
final static <T extends Any> T parseObject(ByteArray $self)
Parses the json byte array as T
- Returns:
T?
- Since:
2.0.3
-
parseObject
final static <T extends Any> T parseObject(ByteArray $self, JSONReader.Feature features)
Parses the json byte array as T with the specified features
- Parameters:
features- the specified features is applied to parsing- Returns:
T?
- Since:
2.0.30
-
parseObject
final static <T extends Any> T parseObject(ByteArray $self, Filter filter, JSONReader.Feature features)
Parses the json byte array as T with the specified filter and features
- Parameters:
filter- the specified filter is applied to parsingfeatures- the specified features is applied to parsing- Returns:
T?
- Since:
2.0.30
-
parseObject
final static <T extends Any> T parseObject(ByteArray $self, Integer offset, Integer length, Charset charset)
Parses the json byte array as T with the specified offset, length and charset
- Returns:
T?
- Since:
2.0.3
-
parseObject
final static <T extends Any> Unit parseObject(Reader $self, Character delimiter, Function1<T, Unit> consumer)
Parses the json reader as T with the specified delimiter and consumer
E.g.
val reader = ... reader.parseObject<User>() { val id = it.id }- Parameters:
delimiter- the specified delimiter is used to distinguish- Since:
2.0.3
-
parseObject
final static <T extends Any> Unit parseObject(InputStream $self, JSONReader.Feature features, Function1<T, Unit> consumer)
Parses the json stream as T with the specified features and consumer
E.g.
val input = ... input.parseObject<User> { val id = it.id }- Parameters:
features- the specified features is applied to parsingconsumer- the specified consumer is applied to parsing- Since:
2.0.3
-
parseObject
final static <T extends Any> Unit parseObject(InputStream $self, Charset charset, Character delimiter, JSONReader.Feature features, Function1<T, Unit> consumer)
Parses the json stream as T with the specified charset and features and so on
E.g.
val input = ... input.parseObject<User>(Charsets.UTF_8) { val id = it.id }- Parameters:
charset- the specified charset of the streamdelimiter- the specified delimiter is used to distinguishfeatures- the specified features is applied to parsingconsumer- the specified consumer is applied to parsing- Since:
2.0.3
-
parseArray
final static JSONArray parseArray(String $self)
Parses the json string as JSONArray
E.g.
val json = ... val data = json.parseArray()- Returns:
JSONArray?
- Since:
2.0.3
-
parseArray
final static <T extends Any> List<T> parseArray(String $self)
Parses the json string as a list of T
E.g.
val json = ... val list = json.parseArray<User>()- Returns:
List?
- Since:
2.0.3
-
parseArray
final static <T extends Any> List<T> parseArray(String $self, JSONReader.Feature features)
Parses the json string as a list of T with the specified features
- Parameters:
features- the specified features is applied to parsing- Returns:
List?
- Since:
2.0.3
-
parseArray
final static <T extends Any> List<T> parseArray(ByteArray $self, JSONReader.Feature features)
Parses the json byte array as a list of T with the specified features
- Parameters:
features- the specified features is applied to parsing- Returns:
List?
- Since:
2.0.3
-
toJSONString
final static String toJSONString(Object $self)
Serializes this object to the json string
E.g.
val obj = ... val text = obj.toJSONString()- Returns:
- Since:
2.0.3
-
toJSONString
final static String toJSONString(Object $self, Array<out Filter> filters)
Serializes this object to the json string with the specified filters
- Parameters:
filters- the specified filters is applied to serialization- Returns:
- Since:
2.0.3
-
toJSONString
final static String toJSONString(Object $self, JSONWriter.Feature features)
Serializes this object to the json string with the specified features
- Parameters:
features- the specified features is applied to serialization- Returns:
- Since:
2.0.3
-
toJSONString
final static String toJSONString(Object $self, Filter filter, JSONWriter.Feature features)
Serializes this object to the json string with the specified filter and features
- Parameters:
filter- the specified filter is applied to serializationfeatures- the specified features is applied to serialization- Returns:
- Since:
2.0.3
-
toJSONString
final static String toJSONString(Object $self, Array<out Filter> filters, JSONWriter.Feature features)
Serializes this object to the json string with the specified filters and features
- Parameters:
filters- the specified filters is applied to serializationfeatures- the specified features is applied to serialization- Returns:
- Since:
2.0.3
-
toJSONByteArray
final static ByteArray toJSONByteArray(Object $self)
Serializes this object to the json byte array
E.g.
val obj = ... val text = obj.toJSONByteArray()- Returns:
- Since:
2.0.3
-
toJSONByteArray
final static ByteArray toJSONByteArray(Object $self, Array<out Filter> filters)
Serializes this object to the json byte array with the specified filters
- Parameters:
filters- the specified filters is applied to serialization- Returns:
- Since:
2.0.3
-
toJSONByteArray
final static ByteArray toJSONByteArray(Object $self, JSONWriter.Feature features)
Serializes this object to the json byte array with the specified features
- Parameters:
features- the specified features is applied to serialization- Returns:
- Since:
2.0.3
-
toJSONByteArray
final static ByteArray toJSONByteArray(Object $self, Array<out Filter> filters, JSONWriter.Feature features)
Serializes this object to the json byte array with the specified filters and features
- Parameters:
filters- the specified filters is applied to serializationfeatures- the specified features is applied to serialization- Returns:
- Since:
2.0.3
-
-
-
-