Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

NiFi | Json Parsing using Nifi Expression

avatar
Contributor

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 "."character?

1 ACCEPTED SOLUTION

avatar

Hi @Shashi Vish,

The following should be working :

$.feedJobExecutionContexts.['trigger_category.test_shashi']

Keep in mind to set 'return type' to 'json' in your EvaluateJson processor.

Hope this helps.

View solution in original post

2 REPLIES 2

avatar

Hi @Shashi Vish,

The following should be working :

$.feedJobExecutionContexts.['trigger_category.test_shashi']

Keep in mind to set 'return type' to 'json' in your EvaluateJson processor.

Hope this helps.

avatar
Contributor

Thanks... It worked...