【发布时间】:2019-02-22 01:05:34
【问题描述】:
我正在尝试使用 nifi jolttransformjson 来转换我的 JSON。 我在玩这个网站http://jolt-demo.appspot.com/#modify-stringFunctions
我有一个 JSON
{
"response": {
"Attribute": [
{
"id": "670868",
"another_id": "8385",
"category": "A",
"type": "abc"
},
{
"id": "670870",
"another_id": "8385",
"category": "B",
"type": "abc"
}
]
}
}
我的 Jolt Spec 是
enter code here
[
{
"operation": "shift",
"spec": {
"response": {
"Attribute": {
"*": {
"type": "TYPE",
"category": "CATEGORY"
}
}
}
}
}
]
当前输出为
{
"TYPE" : [ "abc", "abc" ],
"CATEGORY" : [ "A", "B" ]
}
想要的输出是
[
{
"TYPE":"abc",
"CATEGORY":"A"
},
{
"TYPE":"abc",
"CATEGORY":"B"
}
]
请帮忙。我尝试了很多组合,但我似乎无法弄清楚。
【问题讨论】:
标签: json apache-nifi jolt