JsonUtils

Utilities to convert from and to JSON format.

API

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

Consumers of the framework may choose to use a different provider.

2 tryRead(Class, String, JsonUtils_JacksonCustomizer)

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

3 tryRead(Class, DataSource, JsonUtils_JacksonCustomizer)

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

4 tryReadAsList(Class, DataSource, JsonUtils_JacksonCustomizer)

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

5 write(Object, DataSink, JsonUtils_JacksonCustomizer)

Writes given pojo to given DataSink .

6 toStringUtf8(Object, JsonUtils_JacksonCustomizer)

Converts given pojo to an UTF8 encoded String .

7 indentedOutput(ObjectMapper)

enable indentation for the underlying generator

8 onlyIncludeNonNull(ObjectMapper)

only properties with non-null values are to be included

9 jdk8Support(ObjectMapper)

add support for JDK 8, e.g. Optional

10 jaxbAnnotationSupport(ObjectMapper)

add support for JAXB annotations

11 readingJavaTimeSupport(ObjectMapper)

add support for reading java.time (ISO)

12 writingJavaTimeSupport(ObjectMapper)

add support for writing java.time (ISO)

13 readingCanSupport(ObjectMapper)

add support for reading Can

14 writingCanSupport(ObjectMapper)

add support for writing Can

Members

getPlatformDefaultJsonProviderForJaxb()

Consumers of the framework may choose to use a different provider.

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

jdk8Support(ObjectMapper)

add support for JDK 8, e.g. Optional

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