java.lang.Object
io.avaje.jex.core.json.JacksonJsonService
- All Implemented Interfaces:
JexExtension,JsonService
Jackson JsonService
-
Constructor Summary
ConstructorsConstructorDescriptionCreate with defaults for JacksonJacksonJsonService(com.fasterxml.jackson.databind.ObjectMapper mapper) Create with a Jackson instance that might have custom configuration. -
Method Summary
Modifier and TypeMethodDescription<T> TjsonRead(Class<T> clazz, InputStream is) **Reads JSON from an InputStream**voidjsonWrite(Object bean, OutputStream os) **Writes a Java Object as JSON to an OutputStream**<T> voidjsonWriteStream(Iterator<T> iterator, OutputStream os) Serializes a stream of Java objects into a JSON-Stream format, using thex-json-streammedia type.
-
Constructor Details
-
JacksonJsonService
public JacksonJsonService()Create with defaults for Jackson -
JacksonJsonService
public JacksonJsonService(com.fasterxml.jackson.databind.ObjectMapper mapper) Create with a Jackson instance that might have custom configuration.
-
-
Method Details
-
jsonRead
Description copied from interface:JsonService**Reads JSON from an InputStream**Reads a JSON-formatted input stream and deserializes it into a Java object of the specified type.
- Specified by:
jsonReadin interfaceJsonService- Parameters:
clazz- the Class object of the desired typeis- the input stream containing the JSON data- Returns:
- the deserialized object
-
jsonWrite
Description copied from interface:JsonService**Writes a Java Object as JSON to an OutputStream**Serializes a Java object into JSON format and writes the resulting JSON to the specified output stream.
- Specified by:
jsonWritein interfaceJsonService- Parameters:
bean- the Java object to be serializedos- the output stream to write the JSON data to
-
jsonWriteStream
Description copied from interface:JsonServiceSerializes a stream of Java objects into a JSON-Stream format, using thex-json-streammedia type. Each object in the stream is serialized as a separate JSON object, and the objects are separated by newlines.- Specified by:
jsonWriteStreamin interfaceJsonService- Parameters:
iterator- the stream of objects to be serializedos- the output stream to write the JSON-Stream data to
-