JSON and JSON-B

AnalyticDB for PostgreSQL supports JSON data types. JSON data can be stored in the TEXT type. When you write data in the JSON or JSON-B format to an instance, AnalyticDB for PostgreSQL verifies the data based on JSON rules to avoid invalid data writes. AnalyticDB for PostgreSQL also provides specific functions to create JSON values in the columns where you want to perform operations.

AnalyticDB for PostgreSQL also supports JSON-B data types. JSON and JSON-B data types are almost identical in usage.

JSON data types are used to store input texts, spaces that are treated as semantically insignificant, the order of JSON object keys, and the duplicate keys and their corresponding data in JSON data. When duplicate keys are queried, the values of the last encountered key are regarded as valid values.

JSON-B data is stored in a binary format. JSON data types do not store spaces that are treated as semantically insignificant or the order of JSON object keys. If duplicate object keys are specified in the input text, the objects of duplicate keys are not stored, and only the last value is retained.

In most scenarios, we recommend that you use JSON-B data types unless the original data order needs to be retained.