[英]Json string to Json using Java and Jolt
I have a json string eg.我有一个 json 字符串,例如。
{ "value": "{\"userSuspended\":false}" }
What would be the correct Jolt spec to map 'userSuspended' to 'state'? map 'userSuspended' 到 'state' 的正确 Jolt 规范是什么?
It needed two transforms and a Javaclass to map the key/value:它需要两个转换和一个 Java 类来 map 键/值:
One way of doing it is to split the value and save what you wanted to state.一种方法是拆分值并将您想要的内容保存到 state。
[
{
"operation": "modify-overwrite-beta",
"spec": {
"stateArray": "=split('\"',@(1,value))"
}
},
{
"operation": "shift",
"spec": {
"stateArray": {
"1": "state"
}
}
}
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.