Reputation: 273
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:
$..*
Upvotes: 3
Views: 4633
Reputation: 313
You need 2 steps. First, extract inner json to your flow content. After that you can access json attributes from this json flow content.
Flow View
Upvotes: 2
Reputation: 28634
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
Upvotes: 3