> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firebolt.io/llms.txt
> Use this file to discover all available pages before exploring further.

# JSON_VALUE_ARRAY

> Reference material for JSON_VALUE_ARRAY function

Takes a JSON document and extracts a JSON array of scalar values to SQL `ARRAY(TEXT)` value.
For JSON strings, removes the outermost quotes and unescapes the values.
Other JSON scalars are not changed.
Returns a SQL `NULL` if a non-array is given, or non-scalar value is given (inside the array).

This function pairs with the [JSON\_EXTRACT](https://docs.firebolt.io/reference-sql/functions-reference/json/json-extract.md) function, which doesn't convert the JSON values to SQL values.

## Syntax

```sql theme={"theme":{"light":"css-variables","dark":"css-variables"}}
JSON_VALUE_ARRAY(<json>)
```

## Parameters

| Parameter | Description | Supported input types |
| :- | :- | :- |
| `<json>` | The JSON document. | `TEXT` |

## Return Type

`ARRAY(TEXT)`

* If any of the input is `NULL` the output is `NULL` (propagates nulls).

## Examples

For the JSON document used in the examples below, see [JSON common example](https://docs.firebolt.io/reference-sql/functions-reference/json.md#json-common-example).
The following example returns `NULL` because `/value/uid` contains a JSON string (not an array), and `'"987654"'` for the raw JSON extract:

```
SELECT JSON_VALUE_ARRAY(JSON_POINTER_EXTRACT('{"key":123,"value":{"uid":"987654","keywords":["insanely","fast","analytics"]}}', '/value/uid')), JSON_POINTER_EXTRACT('{"key":123,"value":{"uid":"987654","keywords":["insanely","fast","analytics"]}}', '/value/uid');
```

| json\_value\_array array(text) null | json\_pointer\_extract text |
| :- | :- |
| NULL | "987654" |

Rows: 1Execution time: 2.90ms

The following example returns the keywords array as SQL `ARRAY(TEXT)`:

```
SELECT JSON_VALUE_ARRAY(JSON_POINTER_EXTRACT('{"value":{"keywords":["insanely","fast","analytics"]}}', '/value/keywords'));
```

| json\_value\_array array(text) |
| :- |
| \['insanely', 'fast', 'analytics'] |

Rows: 1Execution time: 2.33ms

The following example returns `NULL` for a `NULL` input:

```
SELECT JSON_VALUE_ARRAY(NULL);
```

| json\_value\_array array(text) null |
| :- |
| NULL |

Rows: 1Execution time: 5.91ms


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.