Cloud
json_array_extract
Syntax
The json_array_extract() has the following basic syntax.
JSON_ARRAY_EXTRACT('json_array'::JSON,id);
json_array_extract() requires the following parameters:
-
json_array: The array to extract. -
::JSON: Argument indicating that the query is of typejson. -
id: ID of the element to extract. It is read in an array format that starts with 0.
Examples
Basic json_array_extract() function
-
The following example extracts a
jsonarray as ajsonset.SELECT JSON_ARRAY_EXTRACT('["Bougenvile", 2, 12, "Lily"]'::JSON,3);or
SELECT ('["Bougenvile", 2, 12, "Lily"]'::JSON -> 3); -
The extracted array will look like the following.
+------------+ | f | +------------+ | "Lily" | +------------+
Was this helpful?