我需要从路径创建一个json。例如,我的路径及其值如下所示
root/departments[name=dept1]/employees[id=emp1]/firstName = firstName
root/departments[name=dept1]/employees[id=emp1]/lastName = lastName
root/departments[name=dept1]/employees[id=emp2]/firstName = firstName
root/departments[name=dept2]/employees[id=emp1]/firstName = firstName
从这里我需要生成如下的json。
{
"root": {
"departments": [
{
"name": "dept1",
"employees": [
{
"id": "emp1",
"firstName": "firstName",
"lastName": "lastName"
},
{
"id": "emp2",
"firstName": "firstName"
}
]
},
{
"name": "dept2",
"employees": [
{
"id": "emp1",
"firstName": "firstName"
}
]
}
]
}
}
当我签入jsonpath和jsonpointers时,不支持这种结构。
暂无答案!
目前还没有任何答案,快来回答吧!