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

> 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_value`](/query/sql/functions/json/json_value)

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

## Syntax

### Scalar

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

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

### Scalar, json value plain

| 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

### Typical behavior

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

| value |
| - |
| 7 |

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

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