2017-01-23 277 views
1

我试图用Nifi表达式语言解析的json - jsonpathNiFi | JSON解析使用Nifi表达

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

其用途 ''用于节点遍历。如果json有一个节点名称为'。'在里面。

下面是样品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"}}}} 

我想读feedts但其父节点 'trigger_category.test_shashi' 有圆点( '')在其中。我如何逃避那个角色?

回答

2

你应该可以使用括号来引用它,如提到here

所以我相信你使用的JsonPath是$.feedJobExecutionContexts.['trigger_category.test_shashi']