January 2018
Intermediate to advanced
348 pages
8h 17m
English
JSON-B supports customization of the mapping rules by using compile time options such as annotations and runtime customization by using the JsonbConfig class. The JsonbConfig class can be configured by using its withXXX methods, where XXX will be replaced with a specific version of the method. Here's how one can format the JSON output when using Jsonb:
JsonbConfig config = new JsonbConfig().withFormatting(true);Jsonb jsonb = JsonbBuilder.create(config);
Calling toJson on this jsonb instance would result in a formatted output. Apart from formatting, the customization allows for changes in the naming strategy for property names and change in the ordering of serialized properties.
Read now
Unlock full access