我的目标是将JSON对象映射为新JSON对象密钥中的值。例如:
我的起始JSON:
{
"old_key_1" : "some_json_structure_1",
"old_key_2" : "some_json_structure_2",
"old_key_3" : "some_json_structure_3"
}
我的目标JSON:
{
"new_key_1" :
{
"old_key_1" : "some_json_structure_1",
"old_key_2" : "some_json_structure_2",
"old_key_3" : "some_json_structure_3"
}
}
使用JOLT怎么可能:如果我了解得很清楚,我必须使用换档规范,但我不知道如何?
任何人都可以帮助我吗?
提前谢谢
答案 0 :(得分:1)
包装到新对象中
[
{
"operation": "shift",
"spec": {
"*": {
"@": "new_key_1.&" //the "&" means go up the tree 0 levels, grab what is there and subtitute it in
}
}
}
]