JSON数据反扁平化
把点分路径的单层对象还原为嵌套结构。
关于「JSON数据反扁平化」
它属于「JSON 工具」分类:JSON 的格式化、结构变换与各种数据格式互转。
- 把
a.b.c形式的单层键值还原成多层嵌套对象。 - 同时识别
list[0]与list.0两种数组写法,纯数字键会自动还原为数组。 - 分隔符需要与当初扁平化时使用的保持一致,否则无法正确切分路径。
- 常用于把语言包、配置表等扁平数据还原成程序需要的嵌套结构。
完全免费、无需注册;所有处理都在浏览器本地完成,文件不会上传到任何服务器。
相关关键词:JSON数据反扁平化、JSON 工具、反扁平、unflatten、还原、在线工具、免费
如何使用「JSON数据反扁平化」
- 打开工具:打开「JSON数据反扁平化」页面,无需注册、无需安装任何软件。
- 准备输入:粘贴点分路径的单层 JSON,还原为嵌套结构。
- 填入内容:把内容粘贴进输入框,或把文件拖入页面;也可以点击「示例」先填入样例数据试一下。
- 设置选项并处理:按需调整页面上的选项,然后点击处理 / 转换 / 生成按钮。
- 获取结果:处理完全在浏览器本地完成,结果可直接复制或下载,文件不会上传到任何服务器。
常见问题
- 什么时候会用到?
- 当你从表格、环境变量或 i18n 词条里拿到的是
a.b.c这种扁平键,而程序需要嵌套对象时,就用这个工具还原。 - 数组是怎么判断的?
- 如果某一层的键全部是连续的纯数字(或写成
[0]形式),会被还原成数组;只要有一个非数字键,就还原成对象。 - 还原结果和原始数据不一致?
- 最常见的原因是分隔符不匹配,或者原始键名里本身包含分隔符字符。请确认扁平化与反扁平化使用了相同的分隔符设置。
Unflatten JSON
Restore dotted-path objects into nested structures.
About Unflatten JSON
Belongs to “JSON Tools”: Format, transform and convert JSON to and from various data formats.
- Restores
a.b.cflat keys back into a multi-level nested object. - Both
list[0]andlist.0array forms are recognized; purely numeric keys become arrays automatically. - The separator must match the one used when flattening, otherwise paths cannot be split correctly.
- Commonly used to rebuild flat data like language packs or config tables into the nested structure programs expect.
Free, no sign-up; everything runs locally in your browser and files are never uploaded.
Keywords: Unflatten JSON, JSON Tools, unflatten, unflatten nested, restore, online tool, free
How to use Unflatten JSON
- Open the tool:Open the “Unflatten JSON” page — no sign-up and nothing to install.
- Prepare the input:Paste a flat JSON with dotted paths to restore it into a nested structure.
- Provide the input:Paste your content into the input box or drop a file onto the page; you can also click “Sample” to try example data first.
- Adjust options and run:Adjust the options if needed, then click the process / convert / generate button.
- Get the result:Everything runs locally in your browser; copy or download the result — your files are never uploaded.
FAQ
- When is this useful?
- When you get flat keys like
a.b.cfrom a spreadsheet, env vars or i18n entries but your program needs a nested object, use this to rebuild it. - How are arrays detected?
- If all keys at a level are consecutive numeric (or written as
[0]), they become an array; a single non-numeric key makes it an object. - Output differs from the original?
- The usual cause is a mismatched separator, or keys that themselves contain the separator. Make sure flatten and unflatten use the same separator setting.