0
我想用我從其他處理器獲取的值更新JSON文件中的屬性。以下是我的原始JSON文件。需要幫助更新來自Apache NiFi中不同流文件的JSON屬性
{
"applicant": {
"applicant-id": null
"full-name": "Tyrion Lannister",
"mobile-number" : "8435739739",
"email-id" : "[email protected]"
},
"product": {
"product-category" : "Credit Card",
"product-type" : "Super Value Card - Titanium"
}
}
下面是我EvaluavateJsonPath配置,我提取申請人-ID屬性。
下面是我GenerateFlowFile處理器,其產生一個ID值。
現在我需要更新的申請人-ID屬性與下面的原始JSON值(899872120)。
{
"applicant": {
"applicant-id": 899872120
"full-name": "Tyrion Lannister",
"mobile-number" : "8435739739",
"email-id" : "[email protected]"
},
"product": {
"product-category" : "Credit Card",
"product-type" : "Super Value Card - Titanium"
}
}
我試圖用MergeContent合併2流和MergeContent處理器後,可看到在流文件中的申請人-ID屬性值。我嘗試使用UpdateAttribue更新申請人身份證但我無法獲取更新JSON記錄。
以下是我的MergeContent配置。
有什麼我失蹤?
Thanks Mat。但我們在我們的環境中使用1.1.0版本。無論如何,我們可以在該版本中做到嗎? – Sathyaraj
您應該可以使用ReplaceText來匹配「application-id」:null並將其替換爲「application-id」:$ {Application-id}。這是一個更脆弱的,但應該適合您的輸入。 – mattyb