【发布时间】:2018-10-23 03:20:40
【问题描述】:
我正在尝试从 JSON 中提取一个值到 flowfile-attribute。当我运行 EvaluateJsonPath 处理器时,我收到一条错误消息
"Unable to get a scalar value for expression $..fields.storyBoard.stringValue。
输入 JSON 如下所示:
{
"name" : "projects/fakedims-0000/databases/(default)/documents/device/0000",
"fields" : {
"reportKey" : {
"stringValue" : "abc123"
},
"dateOccured" : {
"timestampValue" : "2018-10-14T04:00:00Z"
},
"storyBoard" : {
"stringValue" : "https://path/to/media"
},
"new" : {
"integerValue" : "25"
},
"name" : {
"stringValue" : "device one"
},
"location" : {
"geoPointValue" : {
"latitude" : -78.413751,
"longitude" : 38.156487
}
}
},
"createTime" : "2018-10-19T00:02:26.209335Z",
"updateTime" : "2018-10-19T22:22:24.382136Z"
}
JSONPath 表达式为$..fields.storyBoard.stringValue
我认为正在发生的是处理器返回["https://path/to/media"] 而不仅仅是字符串。
如果对流文件内容而不是属性进行评估,这就是我得到的结果。为什么?我能做些什么来解决它?
【问题讨论】:
标签: json apache-nifi jsonpath