- All Superinterfaces:
JexExtension
- All Known Implementing Classes:
JacksonJsonService,JsonbJsonService
Service responsible for handling JSON-based request and response bodies.
- See Also:
-
Method Summary
Modifier and TypeMethodDescription<T> TjsonRead(Class<T> type, InputStream is) **Reads JSON from an InputStream**voidjsonWrite(Object bean, OutputStream os) **Writes a Java Object as JSON to an OutputStream**<E> voidjsonWriteStream(Iterator<E> iterator, OutputStream os) Serializes a stream of Java objects into a JSON-Stream format, using thex-json-streammedia type.
-
Method Details
-
jsonRead
**Reads JSON from an InputStream**Reads a JSON-formatted input stream and deserializes it into a Java object of the specified type.
- Parameters:
type- the Class object of the desired typeis- the input stream containing the JSON data- Returns:
- the deserialized object
-
jsonWrite
**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.
- Parameters:
bean- the Java object to be serializedos- the output stream to write the JSON data to
-
jsonWriteStream
Serializes 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.- Parameters:
iterator- the stream of objects to be serializedos- the output stream to write the JSON-Stream data to
-