使用 JOLT 规范将值映射到键
Map value to a key using JOLT Spec
是否可以使用 JOLT SPEC 将值映射到键。
我的输入 Json
{
"name": "Rj",
"Age" : "15"
}
Output Json as
{
"Rj" : {
"Age":"15"
}
}
请为上述场景提供 Json 规范
输入
{
"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"
}
}
]
是否可以使用 JOLT SPEC 将值映射到键。 我的输入 Json
{
"name": "Rj",
"Age" : "15"
}
Output Json as
{
"Rj" : {
"Age":"15"
}
}
请为上述场景提供 Json 规范
输入
{
"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"
}
}
]