这样一个需求,这样的JSON,如果当前的对象下面的type为object,则需要用一个新的对象items包裹里面的层级。例如vardataPre={"name":{"type":"string","desc":"病人姓名","testData":"张三李四","sex":{"type":"object",//这里的type为object"desc":"性别",//如果同级的type为object,需要删除这个字段"testData":"男",//如果同级的type为object,需要删除这个字段"city":{"type":"string","desc":"城市","testData":"杭州"},"street":{"type":"string","desc":"街道","testData":"浦口街道"}}},"order":{"type":"string","desc":"订单","testData":"名称"}}修改成这样的,这个JSON对象总共有三级,可能会有很对数据,大概数据结构就是这样vardataHandle={"name":{"type":"string","desc":"病人姓名","testData":"张三李四","sex":{"type":"object","items"{//这里的为新添加的对象"city":{"type":"string","desc":"城市","testData":"杭州"},"street":{"type":"string","desc":"街道","testData":"浦口街道"}}}},"order":{"type":"string","desc":"订单","testData":"名称"}}谢谢!
手掌心
HUH函数
相关分类