I have escaped JSON dataflow from the ConvertAvroToJSON processor, which looks like this:
{"data": "{\"created_at\":\"Sun Sep 24 11:10:52 +0000 2017\"}"}
I need to extract the "json" value so that it looks like this after unescaping:
{"created_at":"Sun Sep 24 11:10:52 +0000 2017"}
I tried using JoltTransformJSON and EvaluateJsonPath, but both methods return this, with {" and "} at the beginning and end:
{"{"created_at":"Sun Sep 24 11:10:52 +0000 2017"}"}
What should I do to correctly extract the JSON value?
Jolt Spec:
[{ "operation": "shift", "spec": {
"data": {
"*": "&"
} } }]
EvaluateJsonPath:
$..*
use EvaluateJsonPath with $.data expression
if you have {"data": "{\"created_at\":\"Sun Sep 24 11:10:52 +0000 2017\"}"} in the content of your flowfile
it will replace the content with the following data:
{"created_at":"Sun Sep 24 11:10:52 +0000 2017"}
here are all the parameters of the processor

You need 2 steps. First, extract inner json to your flow content. After that you can access json attributes from this json flow content.
First Step:

Second Step

Flow View

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With