> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-3a82795f.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Calcula uma lista de caminhos distintos armazenados em uma coluna JSON.

# distinctJSONPaths

<div id="distinctJSONPaths">
  ## distinctJSONPaths
</div>

Introduzido em: v24.9.0

Calcula uma lista de caminhos distintos armazenados em uma coluna [JSON](/pt-BR/reference/data-types/newjson).

**Sintaxe**

```sql theme={null}
distinctJSONPaths(json)
```

**Argumentos**

* `json` — coluna JSON. [`JSON`](/pt-BR/reference/data-types/newjson)

**Valor retornado**

Retorna a lista ordenada de paths. [`Array(String)`](/pt-BR/reference/data-types/array)

**Exemplos**

**Uso básico com JSON aninhado**

```sql title=Query theme={null}
DROP TABLE IF EXISTS test_json;
CREATE TABLE test_json(json JSON) ENGINE = Memory;
INSERT INTO test_json VALUES ('{"a" : 42, "b" : "Hello"}'), ('{"b" : [1, 2, 3], "c" : {"d" : {"e" : "2020-01-01"}}}'), ('{"a" : 43, "c" : {"d" : {"f" : [{"g" : 42}]}}}');

SELECT distinctJSONPaths(json) FROM test_json;
```

```response title=Response theme={null}
┌─distinctJSONPaths(json)───┐
│ ['a','b','c.d.e','c.d.f'] │
└───────────────────────────┘
```

**Com JSON paths declarados**

```sql title=Query theme={null}
DROP TABLE IF EXISTS test_json;
CREATE TABLE test_json(json JSON) ENGINE = Memory;
INSERT INTO test_json VALUES ('{"a" : 42, "b" : "Hello"}'), ('{"b" : [1, 2, 3], "c" : {"d" : {"e" : "2020-01-01"}}}'), ('{"a" : 43, "c" : {"d" : {"f" : [{"g" : 42}]}}}')

SELECT distinctJSONPaths(json) FROM test_json;
```

```response title=Response theme={null}
┌─distinctJSONPaths(json)─┐
│ ['a','b','c']           │
└─────────────────────────┘
```
