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

> JSON에 저장된 고유 경로와 각 경로의 타입 목록을 계산합니다

# distinctJSONPathsAndTypes

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

도입 버전: v24.9.0

[JSON](/ko/reference/data-types/newjson) 컬럼에 저장된 고유한 경로와 각 경로의 타입 목록을 계산합니다.

<Note>
  JSON 선언에 타입이 지정된 경로가 포함되어 있으면, 입력 데이터에 해당 경로의 값이 없더라도 `distinctJSONPaths/distinctJSONPathsAndTypes` 함수의 결과에는 이러한 경로가 항상 포함됩니다.
</Note>

**구문**

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

**인수**

* `json` — JSON 컬럼. [`JSON`](/ko/reference/data-types/newjson)

**반환 값**

경로와 타입이 정렬된 맵을 반환합니다. [`Map(String, Array(String))`](/ko/reference/data-types/map)

**예시**

**혼합된 타입을 사용하는 기본 사용법**

```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))']} │
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
```

**JSON 경로를 선언한 경우**

```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))']} │
└────────────────────────────────────────────────────────────────┘
```
