JSON Flatten / Unflatten
Flatten a nested JSON into dot-notation keys (e.g. user.address.city) and rebuild the reverse path. Useful to export to CSV, generate .env files or compare configs. Everything in your browser.
JSON inválido — verifique sintaxe.
Quando usar?
Achatar JSON (flatten) transforma estruturas aninhadas em um único nível com chaves em notação de ponto. Útil para exportar para CSV/planilhas, gerar arquivos .env, comparar configurações, ou enviar campos a APIs que esperam pares chave/valor planos.
Reconstruir (unflatten) faz o caminho inverso. Use em scripts de migração, ao mesclar dados de planilhas em estruturas, ou para transformar variáveis de ambiente em config aninhada. Tudo no navegador — nada é enviado a servidores.
From nested JSON to flat keys and back
Sometimes you need a deeply nested JSON as plain key/value pairs: to drop it into a spreadsheet, build a .env file, diff two configs, or feed a system that only takes flat fields. Flattening by hand is tedious and easy to get wrong. Paste your JSON here and it turns into dot-notation keys (user.address.city) as you type. The Unflatten mode does the reverse trip, rebuilding the nested structure from the flat keys.
Two details matter in practice. Array items can come out in bracket notation (tags[0]) or as an index joined by the separator (tags.0) — brackets are what the rebuild step uses to tell an array apart from an object with a key named 0. Empty arrays and objects are kept as [] and {} instead of silently disappearing. And when rebuilding, keys like __proto__, constructor and prototype are rejected on purpose: they are the classic prototype pollution vector in JavaScript.
If any of your keys already contains a dot, change the separator (the field takes up to 3 characters, __ works well) before flattening, or the rebuild will split that key into two levels. A quick sanity check: flatten, paste the result into Unflatten mode and confirm you get the original back. Everything runs in your browser — the JSON never leaves your machine, so internal configs are fine to paste here.
Frequently asked questions
What happens to empty arrays and objects?
Can I use a separator other than a dot?
Why do I get an error about __proto__?
Related Tools
JSON ↔ CSV Converter
Convert data between JSON (array of objects) and CSV bidirectionally. Paste and convert instantly in the browser, no file upload needed.
JSON Validator
Validate JSON data to check for syntax errors. Detailed error report with line and position of the problem.
SemVer Range Tester
Tests which versions satisfy a semver range (^1.2.3, ~2.0, >=1 <2) and explains the range as a lower and an upper bound.