> ## 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 functions

> Unified provides json_extract_string(json_text, path) for extracting a value from JSON text. It returns STRING or NULL.

ReferenceApplies to: Unified engine deployments

Unified provides `json_extract_string(json_text, path)` for extracting a value from JSON text. It returns STRING or NULL.

## json\_extract\_string

| Argument | Required value |
| - | - |
| `json_text` | A STRING containing valid JSON |
| `path` | A literal `$` or `$.field.subfield` object path |

A JSON string returns its unquoted content. Other JSON values are serialized as text. A missing field or JSON-null value returns SQL NULL. Invalid JSON text produces an error. Field names in the supported path are simple object identifiers; array indexes, bracket paths, and wildcards are unavailable.

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT i_item_sk,
       JSON_EXTRACT_STRING(
         CONCAT('{"item":{"code":"', i_item_id, '"}}'),
         '$.item.code'
       ) AS extracted_item_code
FROM demo.tpcds.item
ORDER BY i_item_sk
LIMIT 5;
```

## Missing values

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT JSON_EXTRACT_STRING('{"price":null}', '$.price') AS null_price,
       JSON_EXTRACT_STRING('{"price":12.5}', '$.missing') AS missing_field,
       JSON_EXTRACT_STRING('{"price":12.5}', '$.price') AS price_text;
```

The output is text even when the JSON value is numeric. Apply a supported CAST or TRY\_CAST when a numeric or Boolean SQL value is required.

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT TRY_CAST(JSON_EXTRACT_STRING('{"price":12.5}', '$.price') AS DOUBLE) AS price;
```

Other systems' JSON operators and function names are not automatically aliases for this function. Consult the function inventory and the actual returned error for additional names.


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