我正在try 将给定的input.json
转换为预期的output.json
.我已成功地将该地址转换为字符串,但未能将业余爱好数组转换为所需的输出.
我try 了不同的方法,比如使用$
通配符将键名称更改为name
,但不起作用.我也使用@
通配符将对象的名称从索引更改为某个名称,但也不起作用
Input.json
{
"users": [
{
"name": "John Doe",
"age": 35,
"address": {
"street": "123 Main St",
"city": "Anytown",
"state": "CA",
"zip": "12345"
},
"hobbies": [
{
"name": "reading",
"type": "indoor"
},
{
"name": "hiking",
"type": "outdoor"
}
]
},
{
"name": "Jane Doe",
"age": 30,
"address": {
"street": "456 First St",
"city": "Othertown",
"state": "NY",
"zip": "67890"
},
"hobbies": [
{
"name": "swimming",
"type": "outdoor"
},
{
"name": "painting",
"type": "indoor"
}
]
}
]
}
预期的Output.json
[ {
"Name": "John Doe",
"Address": "123 Main St, Anytown, CA 12345",
"Hobbies": [ "reading", "hiking" ]
},
{
"Name": "Jane Doe",
"Address": "456 First St, Othertown, NY 67890",
"Hobbies": [
"swimming",
"painting"
]
}
]