public final class JsonUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
areTwoJsonObjectEquals(String expectedString,
String toCompare)
Compares two json strings without considering the order of the elements.
|
static <T> T |
deserializeFromStream(InputStream content,
Class<T> objectType)
Deserializes passed JSON stream to object with passed type.
|
static <T> T |
deserializeFromStream(InputStream content,
com.fasterxml.jackson.databind.JavaType objectType)
Deserializes passed JSON stream to object with passed type.
|
static <T> T |
deserializeFromStream(InputStream content,
com.fasterxml.jackson.core.type.TypeReference<T> objectType)
Deserializes passed JSON stream to object with passed type.
|
static <T> T |
deserializeFromString(String content,
Class<T> objectType)
Deserializes passed JSON string to object with passed type.
|
static <T> T |
deserializeFromString(String content,
com.fasterxml.jackson.databind.JavaType objectType)
Deserializes passed JSON string to object with passed type.
|
static <T> T |
deserializeFromString(String content,
com.fasterxml.jackson.core.type.TypeReference<T> objectType)
Deserializes passed JSON string to object with passed type.
|
static void |
serializeToMinimalStream(OutputStream outputStream,
Object value)
Serializes passed object to minimal JSON without spaces and line breaks and writes it into provided stream.
|
static String |
serializeToMinimalString(Object value)
Serializes passed object to minimal JSON string without spaces and line breaks.
|
static void |
serializeToStream(OutputStream outputStream,
Object value)
Serializes passed object to provided JSON output stream.
|
static String |
serializeToString(Object value)
Serializes passed object to JSON string.
|
public static boolean areTwoJsonObjectEquals(String expectedString, String toCompare) throws IOException
expectedString - expected json stringtoCompare - string for comparisonIOException - if an I/O error occurspublic static void serializeToStream(OutputStream outputStream, Object value)
outputStream - stream to which the object will be serializedvalue - the object which will be serializedpublic static String serializeToString(Object value)
value - the object which will be serializednull if it is impossible to serialize to JSONpublic static void serializeToMinimalStream(OutputStream outputStream, Object value)
outputStream - stream to which the object will be serializedvalue - the object which will be serializedpublic static String serializeToMinimalString(Object value)
value - the object which will be serializednull if it is impossible to
serialize to JSONpublic static <T> T deserializeFromStream(InputStream content, Class<T> objectType)
T - the type of object which will be deserializedcontent - the JSON stream which represent objectobjectType - the class of object as Class which will be deserializednull if operation of deserialization is impossiblepublic static <T> T deserializeFromStream(InputStream content, com.fasterxml.jackson.core.type.TypeReference<T> objectType)
T - the type of object which will be deserializedcontent - the JSON stream which represent objectobjectType - the class of object as TypeReference which will be deserializednull if operation of deserialization is impossiblepublic static <T> T deserializeFromStream(InputStream content, com.fasterxml.jackson.databind.JavaType objectType)
T - the type of object which will be deserializedcontent - the JSON stream which represent objectobjectType - the class of object as JavaType which will be deserializednull if operation of deserialization is impossiblepublic static <T> T deserializeFromString(String content, Class<T> objectType)
T - the type of object which will be deserializedcontent - the JSON string which represent objectobjectType - the class of object as Class which will be deserializednull if operation of deserialization is impossiblepublic static <T> T deserializeFromString(String content, com.fasterxml.jackson.core.type.TypeReference<T> objectType)
T - the type of object which will be deserializedcontent - the JSON string which represent objectobjectType - the class of object as TypeReference which will be deserializednull if operation of deserialization is impossiblepublic static <T> T deserializeFromString(String content, com.fasterxml.jackson.databind.JavaType objectType)
T - the type of object which will be deserializedcontent - the JSON string which represent objectobjectType - the class of object as JavaType which will be deserializednull if operation of deserialization is impossibleCopyright © 1998–2025 Apryse Group NV. All rights reserved.