JSON
JSON Path Extractor / Flatten
ネストされた JSON を「パス: 値」のフラットなリストに展開(Flatten)し、ネスト構造に再構築(Unflatten)。パス記法は JSONPath/JSON Diff と同じです: store.book[0].price。
Deeply nested JSON is hard to compare or iterate over programmatically. Flatten unrolls such a structure into a flat list of "path: value" pairs (e.g. store.book[0].price: 12.99), and Unflatten rebuilds it.
How to use it
- Flatten: paste nested JSON and get a flat list of every leaf value with its full path.
- Unflatten: paste a list of "path: value" pairs to rebuild a nested JSON structure from it.
- The path notation matches this site's JSONPath and JSON Diff tools — items[0].name for array elements.
Common uses
- Turning a deeply nested API response into a flat list for import into a spreadsheet or analytics system.
- Building a translation dictionary or config back into nested JSON from flat keys (form.errors.email).
- Quickly finding every value on a given topic in a very large JSON document via a flat path list.
Things to keep in mind
Array index notation varies between libraries — this tool uses items[0], though some write items.0 without brackets.
Unflatten requires that paths don't conflict with each other (e.g. one and one.two at the same time) — otherwise the structure can't be unambiguously rebuilt.
よくある質問
JSONを「フラット化」するとはどういうことですか?
ネストしたJSON構造を、store.book[0].priceのようなドット記法・ブラケット記法を使った「パス: 値」の平坦なリストに変換することです。
フラット化したデータを元のネスト構造に戻せますか?
はい、逆方向の変換(unflatten)にも対応しており、フラットなリストから元のネスト構造を再構築できます。
配列の要素はパスの中でどのように表現されますか?
[0]や[1]のようなインデックス付きのキーとしてパスに含まれます。
実際のキー自体にドットが含まれている場合はどうなりますか?
これは曖昧な状況です。パス user.name は、ネストしたオブジェクト {"user": {"name": ...}} を意味することもあれば、フラットなキー {"user.name": ...} を意味することもあります。ドット記法だけではこれを区別できないため、そのようなキーは避けるか、別途処理する必要があります。
すべての類似ツールでパスの形式は同じですか?
いいえ。オブジェクトに対するドット記法(user.name)はほぼどこでも共通ですが、配列のインデックスの表記は異なります — 当ツールでは items[0] を使いますが、括弧なしで items.0 と書くライブラリもあります。