【发布时间】:2019-02-04 17:13:23
【问题描述】:
从嵌套列表中提取数据的 Jolt Spec 是什么
我一直在用apache nifi做实验,我想用joltransformation处理器来解析json流文件内容,但是我无法解析嵌套列表
输入 JSON -
{
"posts": [
{
"network": "test",
"photos": [
{
"a": 1.7722222222222221,
"s": "https://a.com",
"m": "https://b.com",
"l": "https://ccccc.com"
}
]
},
{
"network": "test1",
"photos": [
{
"a": 1.7722222222222221,
"s": "https://d.com",
"m": "https://e.com",
"l": "https://fffff.com"
}
]
}
]
}
JOLT 转换文件 -
[
{
"operation": "shift",
"spec": {
"posts": {
"*": {
"network": "[&1].profile",
"photos": { "0": { "l": "[&1].p" } }
}
}
}
}
]
预期输出 -
[
{
"profile" : "test",
"p" : "https://ccccc.com"
},
{
"profile" : "test1",
"p" : "https://fffff.com"
}
]
实际输出 -
[
{
"profile" : "test",
"p" : [ "https://ccccc.com", "https://ffffff.com" ]
},
{
"profile" : "test1"
}
]
请帮助我,我无法弄清楚我做错了什么
【问题讨论】:
标签: json apache-nifi jolt