Holon Platform JSON Module - Reference Manual
Total Page:16
File Type:pdf, Size:1020Kb
Holon Platform JSON Module - Reference manual Table of Contents 1. Introduction. 2 1.1. Sources and contributions . 3 2. Obtaining the artifacts . 3 2.1. Using the Platform BOM . 4 3. What’s new in version 5.2.x. 4 4. What’s new in version 5.1.x. 4 5. PropertyBox type handling . 4 5.1. Serialization . 5 5.1.1. PropertyBox properties serialization strategy. 5 5.2. Deserialization. 6 5.3. Property set serialization and deserialization strategies. 7 6. Date and time data types . 8 6.1. java.time.* data types support . 8 6.2. java.util.Date serialization and deserialization . 9 7. The Json API . 9 7.1. Obtain an implementation . 9 7.1.1. Currently available implementations . 10 7.2. Serialization. 10 7.2.1. PropertyBox serialization . 11 7.2.2. Generic Collections serialization. 12 7.3. Deserialization . 13 7.3.1. PropertyBox deserialization. 14 7.3.2. JSON arrays deserialization . 14 8. Supported JSON libraries . 15 9. Jackson integration . 15 9.1. Jackson ObjectMapper configuration . 15 9.1.1. PropertyBox type support. 16 9.1.2. PropertyBox serialization configuration. 17 9.1.3. Jackson java.time.* data types support . 17 9.1.4. ISO-8601 java.util.Date serialization . 18 9.2. Jackson Json API implementation. 19 9.3. JAX-RS integration . 19 9.3.1. PropertyBox type deserialization . 20 9.3.2. Deal with the JAX-RS context ObjectMapper instance . 22 9.3.3. JAX-RS integration configuration . 23 9.4. Spring integration. 23 9.5. Spring Boot integration . 24 10. Gson integration. 24 10.1. Gson GsonBuilder configuration . 25 10.1.1. PropertyBox type support . 25 10.1.2. PropertyBox serialization configuration . 26 10.2. Gson java.time.* data types support. 27 10.3. ISO-8601 java.util.Date serialization . 27 10.4. Gson Json API implementation . 28 10.5. JAX-RS integration . 29 10.5.1. PropertyBox type deserialization . 29 10.5.2. Deal with the JAX-RS context Gson instance . 31 10.5.3. JAX-RS integration configuration . 32 10.6. Spring integration . 32 10.7. Spring Boot integration. 33 11. Loggers . 33 12. System requirements . 34 12.1. Java . 34 Copyright © 2016-2019 Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically. 1. Introduction The Holon Platform JSON module provides the support for the JSON data-interchange format, including configuration facilities, data abstraction, PropertyBox type support and seamless integration with the most popular JSON mapping and processing libraries: Jackson and Gson. Through the Json API, the JSON serialization and deserialization using Java object types can be handled in an abstract and implementation-independent way, easily dealing with common JSON mapping concerns such as temporal types consistent support and generic collection types, besides a full support of the Holon platform Property model out-of-the-box. Furthermore, the JSON module faces the following integration concerns: • Gson GsonBuilder configuration • Jackson ObjectMapper configuration • Full support of the Java 8 date and time API for the java.time.* data types serialization and deserialization • Consistent Date data types handling using the ISO-8601 format • JAX-RS integration and auto-configuration • Spring boot auto-configuration 1.1. Sources and contributions The Holon Platform JSON module source code is available from the GitHub repository https://github.com/holon-platform/holon-json. See the repository README file for information about: • The source code structure. • How to build the module artifacts from sources. • Where to find the code examples. • How to.