# json_array_extract

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [cloud-data-platform-full.txt](https://docs.redpanda.com/cloud-data-platform-full.txt)

---
title: json_array_extract
latest-operator-version: v26.1.4
latest-console-tag: v3.7.3
latest-connect-version: 4.93.0
latest-redpanda-tag: v26.1.9
docname: sql/sql-functions/json-functions/json-array-extract
page-component-name: cloud-data-platform
page-version: master
page-component-version: master
page-component-title: Cloud
page-relative-src-path: sql/sql-functions/json-functions/json-array-extract.adoc
page-edit-url: https://github.com/redpanda-data/cloud-docs/edit/main/modules/reference/pages/sql/sql-functions/json-functions/json-array-extract.adoc
description: The `json_array_extract()` function returns the JSON array as a set of JSON values.
page-topic-type: reference
page-git-created-date: "2026-05-26"
page-git-modified-date: "2026-05-26"
---

<!-- Source: https://docs.redpanda.com/cloud-data-platform/reference/sql/sql-functions/json-functions/json-array-extract.md -->

## [](#overview)Overview

The `json_array_extract()` function returns the `json` array as a set of `json` values.

## [](#syntax)Syntax

The `json_array_extract()` has the following basic syntax.

```sql
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 type `json`.

-   `id`: ID of the element to extract. It is read in an array format that starts with 0.


### [](#another-option)Another option

`json_array_extract` can also be achieved with the `→` operator, as shown in the following syntax:

```sql
SELECT 'from_json'::JSON -> path;
```

-   `from_json`: The `json` value from which to extract.

-   `::JSON`: A symbol that casts the string literal to a `json` type.

-   `path`: Key of the field to extract.


## [](#examples)Examples

### [](#basic-json_array_extract-function)Basic `json_array_extract()` function

1.  The following example extracts a `json` array as a `json` set.

    ```sql
    SELECT JSON_ARRAY_EXTRACT('["Bougenvile", 2, 12, "Lily"]'::JSON,3);
    ```

    **or**

    ```sql
    SELECT ('["Bougenvile", 2, 12, "Lily"]'::JSON -> 3);
    ```

2.  The extracted array will look like the following.

    ```sql
    +------------+
    | f          |
    +------------+
    | "Lily"     |
    +------------+
    ```


### [](#extract-element-of-json-array-as-text)Extract element of JSON array as text

1.  This example extracts the element of the `json` array as text with the `→>` operator.

    ```sql
    SELECT ('["Bougenvile", 2, 12, "Lily"]'::JSON ->> 1);
    ```

2.  Output:

    ```sql
    +------------+
    | f          |
    +------------+
    | 2.000000   |
    +------------+
    ```