Flatten nested JSON into explicit paths and values
Flatten converts nested leaves into a map whose keys are full JSON paths. Quoted bracket paths distinguish a literal dot in a name from a navigation separator.
When should you use it?
- Inspect all leaf values in a nested configuration.
- Prepare path/value pairs for mapping work.
- Compare fields across structures with explicit locations.
Example: name each leaf by its path
Quoted brackets distinguish property names from array indexes and allow special characters in keys.
{"user":{"name":"Alex"}}{"$[\"user\"][\"name\"]":"Alex"}Keep path syntax separate from property text
A dotted key such as user.name can be confused with a nested user object. This tool writes quoted bracket paths beginning at $, with numeric segments for array indexes. That makes a literal dot in a property name distinguishable from a structural boundary. Leaf values are attached to their full locations; empty containers are retained so their existence is not lost.
Choose flattening for inspection or a defined interchange
A path map is useful for comparing nested fields, reviewing configuration overrides, or documenting where values live. It is not automatically the flat row format expected by a CSV consumer. Use the matching Unflatten tool to rebuild this path notation. If another system expects dotted names or a different array convention, define that mapping explicitly before importing the result.
How do I flatten nested JSON without confusing dots in key names?
The flattener names each leaf with a root-based bracket path. A property called a.b is represented as one quoted member, while nested a then b produces two bracket segments. That distinction matters when a path/value export must be reversed later.
Two different shapes produce different paths
text{"a.b":1} → $["a.b"]
{"a":{"b":1}} → $["a"]["b"]Empty arrays and objects also get path entries so a round trip can keep their presence.
Can I import these paths into a dot-notation flattener?
Only if that tool understands this exact $ bracket format. Dot notation commonly treats dots in property names as separators and may produce a different structure.
What should you check before using the result?
The path map is a transport shape for this site’s notation, not a generic dot-path format. Review consumers that expect other flatten conventions.
Understand JSON pathsTechnical reference: JSON syntax and interoperability · RFC 8259