Split JSON flow file and recompose to new flow content
Hi at all,
I have a JSON in my FlowFile content like this
{
"headers": {
"key_1":"value_1",
......
"key_n":"value_n"},
"info": { "key_1":"value_1",
......
"key_n":"value_n"},
"payload": {
"key_1":"value_1",
......
"key_n":"value_n"}
}
my aim in the flow is:
- split the original JSON into three attributes (headers, payload and info)
- route on a global variable into two subflows
- merge headers+info+core attributes
- merge headers+info+payload attributes
- add core attributes to new JSON content (like uuid, kafka topic, kafka partition, kafka offset)
- send the new json to splunk with HttpInvoke POST
I've tried to implement the bullets 1 with EvaluateJSONPath processor and 2.1, 2.2, 3 bullets with AttributesToJSON processor but I've got this problem:
in AttributesToJSON if I use flow-file content as Destination the merge works but it writes headers, info and payload values like unique values instead of other key-value json object. Here an example:
{
"headers": "{\"key_1\":\"value_1\",
......
\"key_n\":\"value_n\"}]}}}",
"info": "{\"key_1\":\"value_1\",
......
\"key_n\":\"value_n\"}]}}}",
"payload": "{\"key_1\":\"value_1\",
......
\"key_n\":\"value_n\"}]}}}",
"kafka.partition": "1"
}
Any ideas?
Thank you!

