public class JSONSerialisation extends Object
Constructor and Description |
---|
JSONSerialisation(com.fasterxml.jackson.databind.ObjectMapper mapper)
New default instance of the JSONSerialsation.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
deserialise(String text,
Class<T> clazz)
Deserialise JSON to an object of type T.
|
static String |
jsonAttributeName(String name)
Wrap the attribute name in quotes and a colon to make it look like a JSON attribute.
|
<T> String |
serialise(T object)
Serialise an object to JSON.
|
@Inject public JSONSerialisation(@Named(value="cts-json-object-mapper") com.fasterxml.jackson.databind.ObjectMapper mapper)
public <T> String serialise(T object)
T
- The generic type of the passed in object.object
- Non null object to serialise.public <T> T deserialise(String text, Class<T> clazz)
T
- Type to cast the created object to when deserialising.text
- Non null JSON text to parse and deserialise.clazz
- Class which contains the type of the value stored in JSON, required for deserialsiation.Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.