HTML Serializers
The HtmlSerializer class is used to serialize POJOs into HTML. The HtmlDocSerializer class is the same but wraps the serialized POJO inside a document template consisting of header, nav, aside, and footer sections.
The class hierarchy for the builder of this serializer is:
Refer to the builder javadocs for configurable settings.
The following pre-configured serializers are provided for convenience:
Data type representations
The following tables are the complete reference for how each POJO datatype is rendered by HtmlSerializer.
They mirror how the same data structures are represented in JSON.
See HTML Methodology for a conceptual overview of the mapping rules.
Maps
Maps and beans are represented as tables.
The _type attribute is added to differentiate between objects (Maps/beans) and arrays (arrays/Collections).
| Data type | JSON example | HTML |
|---|---|---|
| Map | | |
| Map | | |
| Map | | |
Arrays
Collections and arrays are represented as ordered lists.
| Data type | JSON example | HTML |
|---|---|---|
| String[] | | |
| Number[] | | |
| Object[] | | |
| String[][] | | |
| int[] | | |
| boolean[] | | |
Collections
Collections serialize identically to their array equivalents.
| Data type | JSON example | HTML |
|---|---|---|
| List<String> | | |
| List<Number> | | |
| List<Object> | | |
Beans
| Data type | JSON example | HTML |
|---|---|---|
| | |
Beans with Map properties
| Data type | JSON example | HTML |
|---|---|---|
| | |