Shashi
Shashi

Reputation: 2714

NiFi | Json Parsing using Nifi Expression

I am trying to parse my json using Nifi Expression language - jsonpath

https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#jsonpath

Its uses '.' for node traversal. If json which has one node name with '.' in it.

Below is sample json

{"feedName":"trigger_category.childfeed123",
"feedId":"eff68e0b-a9e6-4c11-b74f-53f161a47faf",
"dependentFeedNames":["trigger_category.test_shashi"],
"feedJobExecutionContexts":{"trigger_category.test_shashi":[{"jobExecutionId":23946,
"startTime":1485145059971,
"endTime":1485145111733,
"executionContext":{"feedts":"1485145061170"}}]},
"latestFeedJobExecutionContext":{"**trigger_category.test_shashi**":{"jobExecutionId":23946,
"startTime":1485145059971,
"endTime":1485145111733,
"executionContext":{"**feedts**":"1485145061170"}}}}

I am trying to read feedts but its parent node 'trigger_category.test_shashi' has dot ('.') in it. How do i escape that character?

Upvotes: 1

Views: 1237

Answers (1)

JDP10101
JDP10101

Reputation: 1852

You should be able to reference it using brackets like is mentioned here.

So I believe the JsonPath you'd use is $.feedJobExecutionContexts.['trigger_category.test_shashi'].

Upvotes: 2

Related Questions