> ## 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カラムに格納されている一意のパスの一覧を計算します。

# distinctJSONPaths

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

導入バージョン: v24.9.0

[JSON](/ja/reference/data-types/newjson)カラムに格納されている一意のパスの一覧を計算します。

**構文**

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

**引数**

* `json` — JSONカラム。[`JSON`](/ja/reference/data-types/newjson)

**戻り値**

ソートされたパスの一覧を返します。[`Array(String)`](/ja/reference/data-types/array)

**例**

**ネストされたJSONの基本的な使い方**

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

**宣言済みの JSON パスを使用する場合**

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