JSON flatten / unflatten

Client

Convert nested objects to a single-level map with dot keys, or reverse the process from a flat JSON object.

Learn more: flat keys

Turn nested objects into dot paths (and array indices as numeric segments), or rebuild nesting from a flat map—common for environment variables and some i18n bundles.

Round-trip

Flatten produces one key per leaf. Unflatten expects an object whose keys are those paths; values should be primitives or JSON-encoded strings for complex leaves.

Flatten & unflatten

?

Nested objects become keys like user.profile.city. Array indices appear as numeric segments. Paste a flat object back to rebuild nesting.

Nearby workflows on Toolcore

  • JSON formatterwhen the document must parse before any transform or export.
  • JSON propertieswhen you need path lists without full flattening.

Common use cases

  • Turn nested config into flat key=value maps for env files, feature flags, or translation tables.
  • Inspect deep structures as a sorted list of paths when debugging unknown JSON.
  • Round-trip flatten → unflatten to confirm dot-path conventions before importing into spreadsheets or databases.
  • Prepare column-major or ETL-friendly keys when the downstream system only accepts a single object depth.

Common mistakes to avoid

  • Keys that already contain dots

    Flattening encodes structure with dots in path names. If a real key contains a dot, round-trip may need quoting rules—verify your consumer’s expectations.

  • Losing array order when treating indices as strings

    Numeric indices are usually ordered as array slots. After unflattening, confirm the array length matches what you expect.

  • Colliding paths when unflattening hand-edited flat maps

    If both `a.b` and `a` exist as keys, unflattening can be ambiguous. Normalize keys in the flat map before rebuilding nested JSON.

FAQ

Does flattening upload my JSON?

No. Conversion runs entirely in your browser tab.

Is this the same as JSON Pointer paths?

Both use path-like strings, but flattening produces a flat object keyed by those paths. Pointers (RFC 6901) address a single node inside one document—related concepts, different outputs.

How does this relate to JSON → env / env → JSON?

Flatten/unflatten stays inside JSON-shaped data. Use the env tools when targeting shell-style KEY=value exports and their escaping rules.

Common search terms

Phrases people search for that match this tool. See the full long-tail keyword index.

  • flatten json object online
  • unflatten dot notation json

Related utilities you can open in another tab—mostly client-side.