[英]Nifi Jolt Transform Spec
I'm trying to use nifi jolttransformjson to transform my JSON. I'm playing around using this site http://jolt-demo.appspot.com/#modify-stringFunctions我正在尝试使用 nifi jolttransformjson 来转换我的 JSON。我正在使用这个网站http://jolt-demo.appspot.com/#modify-stringFunctions
I have a JSON我有一个 JSON
{
"response": {
"Attribute": [
{
"id": "670868",
"another_id": "8385",
"category": "A",
"type": "abc"
},
{
"id": "670870",
"another_id": "8385",
"category": "B",
"type": "abc"
}
]
}
}
My Jolt Spec is我的震动规格是
enter code here
[
{
"operation": "shift",
"spec": {
"response": {
"Attribute": {
"*": {
"type": "TYPE",
"category": "CATEGORY"
}
}
}
}
}
]
Current Output is目前Output是
{
"TYPE" : [ "abc", "abc" ],
"CATEGORY" : [ "A", "B" ]
}
Wanted output is通缉output现
[
{
"TYPE":"abc",
"CATEGORY":"A"
},
{
"TYPE":"abc",
"CATEGORY":"B"
}
]
Help please.请帮忙。 I tried so many combinations and I can't seem to figure this out.
我尝试了很多组合,但我似乎无法弄清楚。
See Map to List
example and you will find out solution:请参阅
Map to List
示例,您将找到解决方案:
[
{
"operation": "shift",
"spec": {
"response": {
"Attribute": {
"*": {
"@type": "[#2].TYPE",
"@category": "[#2].CATEGORY"
}
}
}
}
}
]
[
{
"operation": "shift",
"spec": {
"response" : {
"Attribute" : {
"*" : {
"type" : "[&1].TYPE",
"category" : "[&1].CATEGORY"
}
}
}
}
}
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.