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

> Calcule la liste des chemins distincts et de leurs types stockés dans le JSON

# distinctJSONPathsAndTypes

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

Introduit dans : v24.9.0

Calcule la liste des chemins distincts et de leurs types stockés dans une colonne [JSON](/fr/reference/data-types/newjson).

<Note>
  Si la déclaration JSON contient des chemins avec des types spécifiés, ces chemins seront toujours inclus dans le résultat des fonctions `distinctJSONPaths/distinctJSONPathsAndTypes`, même si les données d’entrée ne contenaient pas de valeurs pour ces chemins.
</Note>

**Syntaxe**

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

**Arguments**

* `json` — colonne JSON. [`JSON`](/fr/reference/data-types/newjson)

**Valeur renvoyée**

Renvoie la map triée des chemins et des types. [`Map(String, Array(String))`](/fr/reference/data-types/map)

**Exemples**

**Utilisation de base avec des types mixtes**

```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 distinctJSONPathsAndTypes(json) FROM test_json;
```

```response title=Response theme={null}
┌─distinctJSONPathsAndTypes(json)───────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ {'a':['Int64'],'b':['Array(Nullable(Int64))','String'],'c.d.e':['Date'],'c.d.f':['Array(JSON(max_dynamic_types=16, max_dynamic_paths=256))']} │
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
```

**Avec des chemins JSON déclarés**

```sql title=Query theme={null}
DROP TABLE IF EXISTS test_json;
CREATE TABLE test_json(json JSON(a UInt32)) ENGINE = Memory;
INSERT INTO test_json VALUES ('{"b" : "Hello"}'), ('{"b" : "World", "c" : [1, 2, 3]}');

SELECT distinctJSONPathsAndTypes(json) FROM test_json;
```

```response title=Response theme={null}
┌─distinctJSONPathsAndTypes(json)────────────────────────────────┐
│ {'a':['UInt32'],'b':['String'],'c':['Array(Nullable(Int64))']} │
└────────────────────────────────────────────────────────────────┘
```
