JsonUtils

Utilities to convert from and to JSON format.

API

JsonUtils.java
class JsonUtils {
  Try<T> tryRead(Class<T> mappedType, String stringUtf8, JsonUtils.JacksonCustomizer... customizers)     (1)
  Try<T> tryRead(Class<T> mappedType, DataSource source, JsonUtils.JacksonCustomizer... customizers)     (2)
  Try<List<T>> tryReadAsList(Class<T> elementType, DataSource source, JsonUtils.JacksonCustomizer... customizers)     (3)
  void write(Object pojo, DataSink sink, JsonUtils.JacksonCustomizer... customizers)     (4)
  String toStringUtf8(Object pojo, JsonUtils.JacksonCustomizer... customizers)     (5)
  ObjectMapper indentedOutput(ObjectMapper mapper)     (6)
  ObjectMapper onlyIncludeNonNull(ObjectMapper mapper)     (7)
  ObjectMapper jaxbAnnotationSupport(ObjectMapper mapper)     (8)
  ObjectMapper readingJavaTimeSupport(ObjectMapper mapper)     (9)
  ObjectMapper writingJavaTimeSupport(ObjectMapper mapper)     (10)
  ObjectMapper readingCanSupport(ObjectMapper mapper)     (11)
  ObjectMapper writingCanSupport(ObjectMapper mapper)     (12)
}
1 tryRead(Class, String, JsonUtils_JacksonCustomizer)

Tries to deserialize JSON content from given UTF8 encoded String into an instance of given mappedType .

2 tryRead(Class, DataSource, JsonUtils_JacksonCustomizer)

Tries to deserialize JSON content from given DataSource into an instance of given mappedType .

3 tryReadAsList(Class, DataSource, JsonUtils_JacksonCustomizer)

Tries to deserialize JSON content from given DataSource into a List with given elementType .

4 write(Object, DataSink, JsonUtils_JacksonCustomizer)

Writes given pojo to given DataSink .

5 toStringUtf8(Object, JsonUtils_JacksonCustomizer)

Converts given pojo to an UTF8 encoded String .

6 indentedOutput(ObjectMapper)

enable indentation for the underlying generator

7 onlyIncludeNonNull(ObjectMapper)

only properties with non-null values are to be included

8 jaxbAnnotationSupport(ObjectMapper)

add support for JAXB annotations

9 readingJavaTimeSupport(ObjectMapper)

add support for reading java.time (ISO)

10 writingJavaTimeSupport(ObjectMapper)

add support for writing java.time (ISO)

11 readingCanSupport(ObjectMapper)

add support for reading Can

12 writingCanSupport(ObjectMapper)

add support for writing Can

Members

tryRead(Class, String, JsonUtils_JacksonCustomizer)

Tries to deserialize JSON content from given UTF8 encoded String into an instance of given mappedType .

tryRead(Class, DataSource, JsonUtils_JacksonCustomizer)

Tries to deserialize JSON content from given DataSource into an instance of given mappedType .

tryReadAsList(Class, DataSource, JsonUtils_JacksonCustomizer)

Tries to deserialize JSON content from given DataSource into a List with given elementType .

write(Object, DataSink, JsonUtils_JacksonCustomizer)

Writes given pojo to given DataSink .

toStringUtf8(Object, JsonUtils_JacksonCustomizer)

Converts given pojo to an UTF8 encoded String .

indentedOutput(ObjectMapper)

enable indentation for the underlying generator

onlyIncludeNonNull(ObjectMapper)

only properties with non-null values are to be included

jaxbAnnotationSupport(ObjectMapper)

add support for JAXB annotations

readingJavaTimeSupport(ObjectMapper)

add support for reading java.time (ISO)

writingJavaTimeSupport(ObjectMapper)

add support for writing java.time (ISO)

readingCanSupport(ObjectMapper)

add support for reading Can

writingCanSupport(ObjectMapper)

add support for writing Can