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

# JSON_EXTRACT

> Extracts a JSON value from text using a path.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Scalar function</span></div>

NULL inputs or a missing/invalid path return NULL.

## Syntax

### Scalar

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
json_extract(json_string, path)
```

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| json\_string | STRING | Yes | JSON text. |
| path | STRING | Yes | Path to extract. |

## Returns

* Type: STRING
* NULL behavior: NULL inputs or a missing/invalid path return NULL.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Supports window usage | No |
| Exact result | Yes |

## Units

* Input unit: Array path indices are zero based.
* Output unit: Text

## Usage notes

* Array indices are zero based.
* JSON strings are quoted in the output; objects and arrays are returned as raw JSON text.
* A root \$ or empty path returns the original JSON text.
* Deterministic: The same inputs and settings produce the same result.

## Examples

### Typical behavior

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT json_extract('{"a":7}', '$.a') AS "value";
```

| value |
| - |
| 7 |

### Read an array element and a missing field

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT json_extract('{"items":[10,20]}', '$.items[1]') AS second_item, json_extract('{"items":[10,20]}', '$.missing') AS missing;
```

| second\_item | missing |
| - | - |
| 20 | NULL |

## Limitations

* Use the path syntax and extraction forms shown on this page.

## Related functions

* [json\_extract\_scalar](/query/sql/functions/json/json_extract_scalar)
* [get\_json\_object](/query/sql/functions/json/get_json_object)


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