EvaluateJsonPath 2025.10.2.19

捆绑包

org.apache.nifi | nifi-standard-nar

描述

Evaluates one or more JsonPath expressions against the content of a FlowFile. The results of those expressions are assigned to FlowFile Attributes or are written to the content of the FlowFile itself, depending on configuration of the Processor. JsonPaths are entered by adding user-defined properties; the name of the property maps to the Attribute Name into which the result will be placed (if the Destination is flowfile-attribute; otherwise, the property name is ignored). The value of the property must be a valid JsonPath expression. A Return Type of 'auto-detect' will make a determination based off the configured destination. When 'Destination' is set to 'flowfile-attribute,' a return type of 'scalar' will be used. When 'Destination' is set to 'flowfile-content,' a return type of 'JSON' will be used. If the JsonPath evaluates to a JSON array or JSON object and the Return Type is set to 'scalar' the FlowFile will be unmodified and will be routed to failure. A Return Type of JSON can return scalar values if the provided JsonPath evaluates to the specified value and will be routed as a match. If Destination is 'flowfile-content' and the JsonPath does not evaluate to a defined path, the FlowFile will be routed to 'unmatched' without having its contents modified. If Destination is 'flowfile-attribute' and the expression matches nothing, attributes will be created with empty strings as the value unless 'Path Not Found Behaviour' is set to 'skip', and the FlowFile will always be routed to 'matched.'

标签

JSON、JsonPath、evaluate

输入要求

REQUIRED

支持敏感的动态属性

false

属性

属性

描述

目标

表示 JsonPath 评估结果是写入 FlowFile 内容还是写入 FlowFile 属性;如果使用属性,则必须指定“属性名称”属性。如果设置为 flowfile-content,则只能指定一个 JsonPath 且属性名称将被忽略。

最大字符串长度

解析 JSON 文档时字符串值的最大允许长度

Null 值表示形式

表示生成 null 值的 JSON 路径表达式的所需表示形式。

路径未找到行为

表示在目标设置为“flowfile-attribute”时如何处理缺失的 JSON 路径表达式。当找不到 JSON 路径表达式时,选择“warn”将生成警告。选择“skip”将省略任何不匹配 JSON 路径表达式的属性。

返回类型

Indicates the desired return type of the JSON Path expressions. Selecting 'auto-detect' will set the return type to 'json' for a Destination of 'flowfile-content', and 'scalar' for a Destination of 'flowfile-attribute'.

关系

名称

描述

failure

当 JsonPath 无法根据 FlowFile 的内容进行评估时,FlowFiles 将路由到此关系;例如,如果 FlowFile 非有效 JSON

matched

成功评估 JsonPath 且 FlowFile 因此被修改后,FlowFiles 将路由到此关系

unmatched

当 JsonPath 与 FlowFile 的内容不匹配且目标设置为“flowfile-content”时,FlowFiles 将路由到此关系

语言: 中文