我正在尝试使用JOLT进行转换。
以下是我的意见,期望和规格。如何仅显示不带大括号的货币?
输入
{
"txn": [
{
"direction": "BUY",
"currency": "USD"
},
{
"direction": "SELL",
"currency": "EUR"
}
]
}
规格
[
{
"operation": "shift",
"spec": {
"txn": {
"*": {
"direction": {
"BUY": {
"@2": "buyCurrency"
}
}
}
}
}
}
]
预期产量
{
"buyCurrency" : "USD"
}
当前输出
{
"buyCurrency" : {
"direction" : "BUY",
"currency" : "USD"
}
}
答案 0 :(得分:0)
尝试
[
{
"operation": "shift",
"spec": {
"txn": {
"*": {
"direction": {
"BUY": {
"@2": "."
}
}
}
}
}
},
{
"operation": "remove",
"spec": {
"direction": ""
}
},
{
"operation": "shift",
"spec": {
"currency": "currency"
}
}
]