apache-nifi - 如何删除 JSON 的键并将整个内容作为内容返回?
问题描述
我的属性员工具有以下 JSON 值:
{"testQuery": {"$set": {"name":"Harsh"} }}
我想将{"$set": {"name":"Harsh"} }
流文件内容而不是属性发送到customizedProcessor,需要执行以下操作,
- 从属性employee的JSON值中移除testQuery键,
- 将 testQuery 的值转换为 flowFile 内容并返回。
解决方案
我假设您employee
在流文件中有属性值:
{"testQuery": {"$set": {"name":"Harsh"} }}
Flow{"$set": {"name":"Harsh"} }
作为流文件内容获取:
1. ReplaceText - to store attribute into content
Replacement Value = ${employee}
2. EvaluateJsonPath - to extract required json value and put into content
Destination = flowfile-content
value = $.testQuery