public class JsonConversionService extends Object
| Constructor and Description |
|---|
JsonConversionService() |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
fromJson(InputStream in,
Class<T> type)
Parses JSON from an input stream to create a casper type object
|
<T> T |
fromJson(String json,
Class<T> type)
Converts a JSON string to a casper type object
|
String |
toJson(Object clObject)
Converts a Casper type object ot a JSON string
|
void |
toJson(Object clObject,
OutputStream out)
Writes a Casper type object ot a JSON string to an
OutputStream |
String |
writeValueAsString(Object value) |
public String toJson(Object clObject) throws IOException
clObject - the type object to writeIOException - - on write errorpublic String writeValueAsString(Object value) throws com.fasterxml.jackson.core.JsonProcessingException
com.fasterxml.jackson.core.JsonProcessingExceptionpublic void toJson(Object clObject, OutputStream out) throws IOException
OutputStreamclObject - the type object to writeout - the stream to write JSON representation of the clObject toIOException - - on write errorpublic <T> T fromJson(String json, Class<T> type) throws IOException
T - type of object to create from JSONjson - the JSON to parsetype - the class of the object to create from JSONIOException - - on a read errorpublic <T> T fromJson(InputStream in, Class<T> type) throws IOException
T - the type of the object to create from JSONin - the stream to of JSON to parsetype - the class of the object to create from JSONIOException - - on a read errorCopyright © 2022. All rights reserved.