JSON Methodology
The JSON data type produced depends on the Java object type being serialized.
POJO type | JSON type | Example | Serialized form |
---|---|---|---|
String | String | serialize( |
|
Number | Number | serialize(123); |
123
|
Boolean | Boolean | serialize( |
|
Null | Null | serialize( |
|
Beans with properties of any type on this list | Object | serialize( |
{p1:
|
Maps with values of any type on this list | Object | serialize( |
{key1:
|
Collections and arrays of any type on this list | Array | serialize( |
[1,
|
In addition, swaps can be used to convert non-serializable POJOs into serializable forms, such as converting
Calendar
object to ISO8601 strings, or
arrays to Base-64
encoded strings.