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

> Extracts a scalar value from JSON text as a string.

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

**Aliases:** [`json_extract_scalar`](/query/sql/functions/json/json_extract_scalar)

NULL inputs or a missing or invalid path return NULL. Objects and arrays return NULL. A JSON null scalar returns the text `null`.

## Syntax

### Json value plain (scalar)

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

* Takes two arguments, JSON\_VALUE(json\_string, path), and returns STRING. ON EMPTY, ON ERROR, PASSING, and other RETURNING types are outside this alias’s supported forms.

## 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 or invalid path return NULL. Objects and arrays return NULL. A JSON null scalar returns the text `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 unquoted; numbers and Booleans become their textual representations.
* JSON null handling here differs from GET\_JSON\_OBJECT.
* JSON\_VALUE uses the same extraction rules as JSON\_EXTRACT\_SCALAR and returns STRING. Use its two-argument form.
* Deterministic: The same inputs and settings produce the same result.

## Examples

### JSON\_VALUE default STRING form

* Takes two arguments, JSON\_VALUE(json\_string, path), and returns STRING. ON EMPTY, ON ERROR, PASSING, and other RETURNING types are outside this alias’s supported forms.

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT json_value('{"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_value('{"items":[10,20]}', '$.items[1]') AS second_item, json_value('{"items":[10,20]}', '$.missing') AS missing;
```

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

## Limitations

* Use the path syntax and extraction forms shown on this page.
* JSON\_VALUE takes two arguments and returns STRING. ON EMPTY, ON ERROR, and PASSING clauses are not supported.
* A RETURNING clause does not change the STRING result type. Do not use it to request a typed result.

## Related functions

* [json\_extract](/query/sql/functions/json/json_extract)
* [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.