Best practices
Recommended practices for using json.Serializer to enhance
performance and avoid common pitfalls.
The following best practices can help ensure effective use of
json.Serializer:
- Disable
allowImplicitConversionin production to avoid silent errors. - Use native JSON booleans and numbers rather than quoted values (for example, use
trueinstead of"true"). - Favor strict formats for
DATE(YYYY-MM-DD); forDATETIMEandINTERVAL, you have options to use RFC 3339 and ISO 8601 standards, see json.Serializer options. - Use
json_nullattribute when handlingNULLvalues. For more information about managing null with thejson_nullattribute, go to NULLs and empty structures. - Use the
json_nameattribute to map a BDL variable to a JSON element name that cannot be represented as a valid BDL identifier, such as names with spaces or special characters. For details, see Type attributes.