我有一个JSON文档,如下所示:
{
"name": "My Team",
"team size": [
{
"min": [
{
"Leader": 1
},
{
"Followers": 5
},
{
"point cost": 7
}
]
},
{
"max": [
{
"Leader": 1
},
{
"Followers": 9
},
{
"point cost": 11
}
]
}
]
}
我希望它看起来是这样的:
{
"name": "My Team",
"team size": [
{
"size": "min",
"Leader": 1,
"Followers": 5,
"point cost": 7
},
{
"size": "max",
"Leader": 1,
"Followers": 9,
"point cost": 11
}
]
}
但我很难接受.我知道大概是jq . '"team size" |= map(to_entries[] | .key + .values)
,但我的语法不正确.任何帮助都将不胜感激.