我有一个 JSON 对象,其中包含两个数组:idByLine 和 orderLine。我需要从 idByLine 中提取值,将它们与 orderLine 中的值进行比较,然后使用 NiFi 中的 Jolt Transform 生成具有特定结构的 JSON 输出。这是我正在使用的 JSON 结构:
{
"orderLine": [
{
"ID": "1",
"Country": "Country1",
"Email": [
{
"email1": "email1"
},
{
"email2": "email2"
}
]
},
{
"ID": "2",
"Country": "Country2",
"Email": [
{
"email1": "email1"
},
{
"email2": "email2"
}
]
}
],
"idByLine": [
{
"idLine": "1",
"orderId": "AMD123"
},
{
"idLine": "2",
"orderId": "AMD555"
}
]
}
我需要确保 idByLine 的 idLine 值存在于输出 json 中,而其他字段则保留在输出 json 示例中。我如何使用 nifi apache 的 JoltTransfor 来实现这一点?
我需要的输出JSON结构是:
[
{
"idLine": "AMD123",
"ID": "1",
"Country": "Country1",
"Email": [
{
"email1": "email1"
},
{
"email2": "email2"
}
]
},
{
"idLine": "AMD555",
"ID": "2",
"Country": "Country2",
"Email": [
{
"email1": "email1"
},
{
"email2": "email2"
}
]
}
]