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

# FROM_JSON

> Parses JSON text according to a literal SQL schema.

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

NULL, empty/invalid rows produce NULL. Supported field-level type conflicts can become NULL fields rather than discard an otherwise valid struct.

## Syntax

### Scalar

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
from_json(json_string, schema [, options])
```

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| json\_string | STRING | Yes | JSON text to parse. |
| schema | STRING literal containing a SQL/JSON schema | Yes | Requested output schema. Must be a constant argument. |
| options | MAP\<STRING,STRING> | No | Optional parsing settings. Currently accepted but ignored; parsing always uses the same permissive rules for type conflicts. Default: No options. |

## Returns

* Type: Derived from schema; see the type restrictions in Limitations
* NULL behavior: NULL, empty/invalid rows produce NULL. Supported field-level type conflicts can become NULL fields rather than discard an otherwise valid struct.
* Shape: STRUCT fields and nested ARRAY/MAP shapes are derived from the literal schema. Missing/invalid fields can be NULL.
* Ordering: Array value order is preserved by decoding; map/object-key ordering is not a SQL ordering guarantee.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Supports window usage | No |
| Exact result | Partial (Conversion to the requested type can lose precision or return NULL.) |

## Usage notes

* The constant schema argument determines the result type.
* The options argument is accepted but has no effect on parsing.
* Struct fields follow the declared schema; missing fields become nullable values, and arrays/maps retain their declared element/value types.
* Deterministic: The same inputs and settings produce the same result.

## Examples

### Typical behavior

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

| value |
| - |
| 7 |

### Parse fields with different types

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT from_json('{"name":"Ada","active":true}', 'name STRING, active BOOLEAN') AS person;
```

| person |
| - |
| \{"name":"Ada","active":true} |

## Limitations

* Options such as FAILFAST, corrupt-record handling, primitivesAsString, dateFormat, and timestampFormat do not change parsing behavior.
* Nested values can be converted only where the source and target types are compatible with the supported JSON conversions.
* Declared decimal precision and scale are not always preserved. Decimal declarations with precision at most 19 can become BIGINT or DOUBLE; generic DECIMAL/NUMERIC becomes DECIMAL(38, 18), and HUGEINT becomes DECIMAL(38, 0). Do not rely on the schema to preserve an exact decimal representation.

## Related functions

* [to\_json](/query/sql/functions/json/to_json)
* [parse\_json](/query/sql/functions/json/parse_json)


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