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 |
deserializeFromStream(InputStream content, Class
Deserializes passed JSON stream to object with passed type.
|
static |
deserializeFromStream(InputStream content, com.fasterxml.jackson.databind.JavaType objectType)
Deserializes passed JSON stream to object with passed type.
|
static |
deserializeFromStream(InputStream content, com.fasterxml.jackson.core.type.TypeReference
Deserializes passed JSON stream to object with passed type.
|
static |
deserializeFromString(String content, Class
Deserializes passed JSON string to object with passed type.
|
static |
deserializeFromString(String content, com.fasterxml.jackson.databind.JavaType objectType)
Deserializes passed JSON string to object with passed type.
|
static |
deserializeFromString(String content, com.fasterxml.jackson.core.type.TypeReference
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 string
toCompare - string for comparison
IOException - if an I/O error occurs
public static void serializeToStream(OutputStream outputStream, Object value)
outputStream - stream to which the object will be serialized
value - the object which will be serialized
public static String serializeToString(Object value)
value - the object which will be serialized
null if it is impossible to serialize to JSON
public static void serializeToMinimalStream(OutputStream outputStream, Object value)
outputStream - stream to which the object will be serialized
value - the object which will be serialized
public static String serializeToMinimalString(Object value)
value - the object which will be serialized
null if it is impossible to serialize to JSON
public staticT deserializeFromStream(InputStream content, Class objectType)
T - the type of object which will be deserialized
content - the JSON stream which represent object
objectType - the class of object as Class which will be deserialized
null if operation of deserialization is impossible
public staticT deserializeFromStream(InputStream content, com.fasterxml.jackson.core.type.TypeReference objectType)
T - the type of object which will be deserialized
content - the JSON stream which represent object
objectType - the class of object as TypeReference which will be deserialized
null if operation of deserialization is impossible
public staticT deserializeFromStream(InputStream content, com.fasterxml.jackson.databind.JavaType objectType)
T - the type of object which will be deserialized
content - the JSON stream which represent object
objectType - the class of object as JavaType which will be deserialized
null if operation of deserialization is impossible
public staticT deserializeFromString(String content, Class objectType)
T - the type of object which will be deserialized
content - the JSON string which represent object
objectType - the class of object as Class which will be deserialized
null if operation of deserialization is impossible
public staticT deserializeFromString(String content, com.fasterxml.jackson.core.type.TypeReference objectType)
T - the type of object which will be deserialized
content - the JSON string which represent object
objectType - the class of object as TypeReference which will be deserialized
null if operation of deserialization is impossible
public staticT deserializeFromString(String content, com.fasterxml.jackson.databind.JavaType objectType)
T - the type of object which will be deserialized
content - the JSON string which represent object
objectType - the class of object as JavaType which will be deserialized
null if operation of deserialization is impossible
Copyright © 1998–2022 iText Group NV. All rights reserved.