Handling null
This section focuses on the key differences in JSON serialization and deserialization
implicit behaviors for handling null or empty values between json.Serializer and
util.json.
For detailed comparisons and examples, refer to the tables below dedicated to null handling for both APIs.
For more information about managing null with the json_null attribute, go to
NULLs and empty structures.
| Type | BDL value | JSON output | json.Serializer | util.json |
|---|---|---|---|---|
BOOLEAN |
NULL |
null |
ERROR 1 | OK |
FGL-Integer/Number |
NULL |
null |
ERROR 1 | OK |
FGL-STRING |
NULL |
null |
ERROR 1 | OK |
DATE |
NULL |
null |
ERROR 1 | OK |
DATETIME |
NULL |
null |
ERROR 1 | OK |
|
|
NULL |
{} | OK | OK |
|
|
NULL |
[] | OK | OK |
1. Requires json_null="null" or serializeNullAsDefault
| Type | JSON input | Result | json.Serializer | util.json |
|---|---|---|---|---|
BOOLEAN |
null |
NULL |
ERROR 2 | OK |
FGL-Integer |
null |
NULL |
ERROR 2 | OK |
FGL-STRING |
null |
NULL |
ERROR 2 | OK |
DATE |
null |
NULL |
ERROR 2 | OK |
DATETIME |
null |
NULL |
ERROR 2 | OK |
|
|
null |
- | ERROR 2 | OK |
|
|
null |
- | ERROR 2 | OK |
2. Requires json_null="null" or allowNullAsDefault.