JSON Functions

**Examples**

**Usage example**

```
SELECT JSONExtractKeysAndValuesRaw('{"a": [-100, 200.0], "b": "hello"}') AS res;
```

```
┌─res──────────────────────────────────┐
│ [('a','[-100,200.0]'),('b','"hello"')] │
└──────────────────────────────────────┘
```

## JSONExtractKeysAndValuesRawCaseInsensitive[​](#JSONExtractKeysAndValuesRawCaseInsensitive "Direct link to JSONExtractKeysAndValuesRawCaseInsensitive")

Introduced in: v25.8.0

Extracts raw key-value pairs from JSON using case-insensitive key matching. This function is similar to [`JSONExtractKeysAndValuesRaw`](#JSONExtractKeysAndValuesRaw).

**Syntax**

```
JSONExtractKeysAndValuesRawCaseInsensitive(json [, indices_or_keys]...)
```

**Arguments**

- `json` — JSON string to parse [`String`](/docs/sql-reference/data-types/string)
- `indices_or_keys` — Optional. Indices or keys to navigate to the object. Keys use case-insensitive matching [`String`](/docs/sql-reference/data-types/string) or [`(U)Int*`](/docs/sql-reference/data-types/int-uint)

**Returned value**

Returns an array of tuples containing key-value pairs as raw strings. [`Array(Tuple(String, String))`](/docs/sql-reference/data-types/array)

**Examples**

**basic**

```
SELECT JSONExtractKeysAndValuesRawCaseInsensitive('{"Name": "Alice", "AGE": 30}')
```

```
[('Name','"Alice"'),('AGE','30')]
```

## JSONExtractKeysCaseInsensitive[​](#JSONExtractKeysCaseInsensitive "Direct link to JSONExtractKeysCaseInsensitive")

Introduced in: v25.8.0

Parses a JSON string and extracts the keys using case-insensitive key matching to navigate to nested objects. This function is similar to [`JSONExtractKeys`](#JSONExtractKeys).

**Syntax**

```
JSONExtractKeysCaseInsensitive(json [, indices_or_keys]...)
```

**Arguments**

- `json` — JSON string to parse [`String`](/docs/sql-reference/data-types/string)
- `indices_or_keys` — Optional. Indices or keys to navigate to the object. Keys use case-insensitive matching [`String`](/docs/sql-reference/data-types/string) or [`(U)Int*`](/docs/sql-reference/data-types/int-uint)

**Returned value**

Returns an array of keys from the JSON object. [`Array(String)`](/docs/sql-reference/data-types/array)

**Examples**

**basic**

```
SELECT JSONExtractKeysCaseInsensitive('{"Name": "Alice", "AGE": 30}')
```

```
['Name','AGE']
```

**nested**

```
SELECT JSONExtractKeysCaseInsensitive('{"User": {"name": "John", "AGE": 25}}', 'user')
```

```
['name','AGE']
```

## JSONExtractRaw[​](#JSONExtractRaw "Direct link to JSONExtractRaw")

Introduced in: v20.1.0

Returns a part of JSON as unparsed string.

**Syntax**

```
JSONExtractRaw(json[, indices_or_keys, ...])
```

**Arguments**

- `json` — JSON string to parse. [`String`](/docs/sql-reference/data-types/string)
- `indices_or_keys` — A list of zero or more arguments each of which can be either string or integer. [`String`](/docs/sql-reference/data-types/string) or [`(U)Int*`](/docs/sql-reference/data-types/int-uint)

**Returned value**

Returns the part of JSON as an unparsed string. If the part does not exist or has a wrong type, an empty string will be returned. [`String`](/docs/sql-reference/data-types/string)

**Examples**

**Usage example**

```
SELECT JSONExtractRaw('{"a": "hello", "b": [-100, 200.0, 300]}', 'b') AS res;
```

```
┌─res──────────────┐
│ [-100,200.0,300] │
└──────────────────┘
```

## JSONExtractRawCaseInsensitive[​](#JSONExtractRawCaseInsensitive "Direct link to JSONExtractRawCaseInsensitive")

Introduced in: v25.8.0

Returns part of the JSON as an unparsed string using case-insensitive key matching. This function is similar to [`JSONExtractRaw`](#JSONExtractRaw).

**Syntax**

```
JSONExtractRawCaseInsensitive(json [, indices_or_keys]...)
```

**Arguments**

- `json` — JSON string to parse [`String`](/docs/sql-reference/data-types/string)
- `indices_or_keys` — Optional. Indices or keys to navigate to the field. Keys use case-insensitive matching [`String`](/docs/sql-reference/data-types/string) or [`(U)Int*`](/docs/sql-reference/data-types/int-uint)

**Returned value**

Returns the raw JSON string of the extracted element. [`String`](/docs/sql-reference/data-types/string)

**Examples**

**object**

```
SELECT JSONExtractRawCaseInsensitive('{"Object": {"key": "value"}}', 'OBJECT')
```

```
{"key":"value"}
```

## JSONExtractString[​](#JSONExtractString "Direct link to JSONExtractString")

Introduced in: v20.1.0

Parses JSON and extracts a value of String type.

**Syntax**

```
JSONExtractString(json[, indices_or_keys, ...])
```

**Arguments**

- `json` — JSON string to parse. [`String`](/docs/sql-reference/data-types/string)
- `indices_or_keys` — A list of zero or more arguments each of which can be either string or integer. [`String`](/docs/sql-reference/data-types/string) or [`(U)Int*`](/docs/sql-reference/data-types/int-uint)

**Returned value**

Returns a String value if it exists, otherwise returns an empty string. [`String`](/docs/sql-reference/data-types/string)

**Examples**

**Usage example**

```
SELECT JSONExtractString('{"a": "hello", "b": [-100, 200.0, 300]}', 'a') AS res;
```

```
┌─res───┐
│ hello │
└───────┘
```

## JSONExtractStringCaseInsensitive[​](#JSONExtractStringCaseInsensitive "Direct link to JSONExtractStringCaseInsensitive")

Introduced in: v25.8.0

Parses JSON and extracts a string using case-insensitive key matching. This function is similar to [`JSONExtractString`](#JSONExtractString).

**Syntax**

```
JSONExtractStringCaseInsensitive(json [, indices_or_keys]...)
```

**Arguments**

- `json` — JSON string to parse [`String`](/docs/sql-reference/data-types/string)
- `indices_or_keys` — Optional. Indices or keys to navigate to the field. Keys use case-insensitive matching [`String`](/docs/sql-reference/data-types/string) or [`(U)Int*`](/docs/sql-reference/data-types/int-uint)

**Returned value**

Returns the extracted string value, empty string if not found. [`String`](/docs/sql-reference/data-types/string)

**Examples**

**basic**

```
SELECT JSONExtractStringCaseInsensitive('{"ABC": "def"}', 'abc')
```

```
def
```

**nested**

```
SELECT JSONExtractStringCaseInsensitive('{"User": {"Name": "John"}}', 'user', 'name')
```

```
John
```

## JSONExtractUInt[​](#JSONExtractUInt "Direct link to JSONExtractUInt")

Introduced in: v20.1.0

Parses JSON and extracts a value of UInt type.

**Syntax**

```
JSONExtractUInt(json [, indices_or_keys, ...])
```

**Arguments**

- `json` — JSON string to parse. [`String`](/docs/sql-reference/data-types/string)
- `indices_or_keys` — A list of zero or more arguments each of which can be either string or integer. [`String`](/docs/sql-reference/data-types/string) or [`(U)Int*`](/docs/sql-reference/data-types/int-uint)

**Returned value**

Returns a UInt value if it exists, otherwise returns `0`. [`UInt64`](/docs/sql-reference/data-types/int-uint)

**Examples**

**Usage example**

```
SELECT JSONExtractUInt('{"a": "hello", "b": [-100, 200.0, 300]}', 'b', -1) AS res;
```

```
┌─res─┐
│ 300 │
└─────┘
```

## JSONExtractUIntCaseInsensitive[​](#JSONExtractUIntCaseInsensitive "Direct link to JSONExtractUIntCaseInsensitive")

Introduced in: v25.8.0

Parses JSON and extracts a value of UInt type using case-insensitive key matching. This function is similar to [`JSONExtractUInt`](#JSONExtractUInt).

**Syntax**

```
JSONExtractUIntCaseInsensitive(json [, indices_or_keys]...)
```

**Arguments**

- `json` — JSON string to parse [`String`](/docs/sql-reference/data-types/string)
- `indices_or_keys` — Optional. Indices or keys to navigate to the field. Keys use case-insensitive matching [`String`](/docs/sql-reference/data-types/string) or [`(U)Int*`](/docs/sql-reference/data-types/int-uint)

**Returned value**

Returns the extracted UInt value, 0 if not found or cannot be converted. [`UInt64`](/docs/sql-reference/data-types/int-uint)

**Examples**

**basic**

```
SELECT JSONExtractUIntCaseInsensitive('{"COUNT": 789}', 'count')
```

```
789
```

## JSONHas[​](#JSONHas "Direct link to JSONHas")

Introduced in: v20.1.0

Checks for the existence of the provided value(s) in the JSON document.

**Syntax**

```
JSONHas(json[ ,indices_or_keys, ...])
```

**Arguments**