是否可以使用JOLT SPEC将值映射到键。 我的输入Json
{
"name": "Rj",
"Age" : "15"
}
Output Json as
{
"Rj" : {
"Age":"15"
}
}
请为上述情况提供Json SPEC
答案 0 :(得分:4)
输入
{
"name": "Rj",
"Age": "15"
}
规格
[
{
"operation": "shift",
"spec": {
// @(1,name) -> go up 2 level, come back down and
// grab the value at "name" which is "RJ"
// Thus this evaluates to
// "Age" : "RJ.Age"
"Age": "@(1,name).Age"
}
}
]