How to concatenate two JSON documents in PostgreSQL®?
PostgreSQL® offers two types of data types to handle JSON data, JSON
and JSONB
, you can use the opearator ||
to concatenate two JSON objects.
PostgreSQL® offers two types of data types to handle JSON data, JSON
and JSONB
, you can use the opearator ||
to concatenate two JSON objects.
PostgreSQL® offers two types of data types to handle JSON data, JSON
and JSONB
, you can use the function json_object
(jsonb_object
for JSONB
) to create a JSON object from an array of key/value pairs.
PostgreSQL® offers two types of data types to handle JSON data, JSON
and JSONB
, you can use the function json_object
(jsonb_object
for JSONB
) to create a JSON object from two arrays of keys and values.
PostgreSQL® offers two types of data types to handle JSON data, JSON
and JSONB
, you can use the function array_to_json
(array_to_jsonb
for JSONB
) to create a JSON array from an existing array.
PostgreSQL® offers two types of data types to handle JSON data, JSON
and JSONB
, you can use the function json_build_array
(jsonb_build_array
for JSONB
) to create a JSON array from a list of elements.
PostgreSQL® offers two types of data types to handle JSON data, JSON
and JSONB
, you can use several functions to extract the keys and related values in tabular format.
PostgreSQL® offers two types of data types to handle JSON data, JSON
and JSONB
, you can use the function to_json
(to_jsonb
for JSONB
) to convert a table row to a JSON object.
PostgreSQL® offers two types of data types to handle JSON data, JSON
and JSONB
, you can use the function json_pretty
(jsonb_pretty
for JSONB
) to prettify the output.
PostgreSQL® offers two types of data types to handle JSON data, JSON
and JSONB
, and provides several different ways to parse arrays from a JSON document:
This series covers how to solve common problems on JSON datasets with PostgreSQL® and it includes (links will appear once the target pages are up):