Provides the user with the ability to take a nested JSON document and flatten it into a simple key/value pair document. The keys are combined at each level with a user-defined separator that defaults to '.'. This Processor also allows to unflatten back the flattened json. It supports four kinds of flatten mode such as normal, keep-arrays, dot notation for MongoDB query and keep-primitive-arrays. Default flatten mode is 'keep-arrays'.
json, flatten, unflatten
In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. The table also indicates any default values, and whether a property supports the NiFi Expression Language.
Display Name | API Name | Default Value | Allowable Values | Description |
---|---|---|---|---|
Separator | flatten-json-separator | . | The separator character used for joining keys. Must be a JSON-legal character. Supports Expression Language: true (will be evaluated using flow file attributes and variable registry) | |
Flatten Mode | flatten-mode | keep arrays |
| Specifies how json should be flattened/unflattened |
Ignore Reserved Characters | ignore-reserved-characters | false |
| If true, reserved characters in keys will be ignored |
Return Type | flatten-json-return-type | flatten |
| Specifies the desired return type of json such as flatten/unflatten |
Character Set | flatten-json-character-set | UTF-8 | The Character Set in which file is encoded | |
Pretty Print JSON | flatten-json-pretty-print-json | false |
| Specifies whether or not resulted json should be pretty printed |
Name | Description |
---|---|
success | Successfully flattened/unflattened files go to this relationship. |
failure | Files that cannot be flattened/unflattened go to this relationship. |