【发布时间】:2019-06-12 15:50:30
【问题描述】:
我想将现有数据转换为其他数据。请在下面找到现有代码和预期代码。
现有:
{ “标题”:“标题1”, “孩子”: [ { “标题”:“标题”, “孩子”: [ { “标题”:“测试”, “孩子”: [ { "title": "testchild",
},
{
"title": "Descriptionchild",
}
]
},
{
"title": "Description",
}
]
}
]
}
预期:
{ “标题”:“标题1”, “customId”:“title1-xx” “孩子”: [ { “标题”:“标题”, "customId": "Header1-xx", “孩子”: [ { “标题”:“测试”, "customId": "test1-xx", “孩子”: [ { "title": "testchild", "customId": "testchild1-xx"
},
{
"title": "Descriptionchild",
"customId": "Descriptionchild1-xx"
}
]
},
{
"title": "Description",
"customId": "Description1-xx"
}
]
}
]
}
【问题讨论】:
-
你从哪里得到缺失值?请添加您的尝试。
标签: javascript arrays json object tree