@EventDriven @SupportsBatching @InputRequirement(value=INPUT_REQUIRED) @SideEffectFree @Tags(value={"json","flatten","unflatten"}) @CapabilityDescription(value="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\'.") public class FlattenJson extends AbstractProcessor
| Modifier and Type | Field and Description |
|---|---|
static PropertyDescriptor |
CHARACTER_SET |
static PropertyDescriptor |
FLATTEN_MODE |
static AllowableValue |
FLATTEN_MODE_DOT_NOTATION |
static AllowableValue |
FLATTEN_MODE_KEEP_ARRAYS |
static AllowableValue |
FLATTEN_MODE_KEEP_PRIMITIVE_ARRAYS |
static AllowableValue |
FLATTEN_MODE_NORMAL |
static PropertyDescriptor |
IGNORE_RESERVED_CHARACTERS |
static PropertyDescriptor |
PRETTY_PRINT |
private List<PropertyDescriptor> |
properties |
static Relationship |
REL_FAILURE |
static Relationship |
REL_SUCCESS |
private Set<Relationship> |
relationships |
static PropertyDescriptor |
RETURN_TYPE |
static String |
RETURN_TYPE_FLATTEN |
static String |
RETURN_TYPE_UNFLATTEN |
static PropertyDescriptor |
SEPARATOR |
| Constructor and Description |
|---|
FlattenJson() |
| Modifier and Type | Method and Description |
|---|---|
private com.github.wnameless.json.flattener.FlattenMode |
getFlattenMode(String mode) |
Set<Relationship> |
getRelationships() |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
protected void |
init(ProcessorInitializationContext context) |
void |
onTrigger(ProcessContext context,
ProcessSession session) |
private void |
setIgnoreReservedCharacters(boolean ignoreReservedCharacters,
com.github.wnameless.json.flattener.JsonFlattener jsonFlattener) |
onTriggergetControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTruecustomValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitisStatefulgetPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validatepublic static final String RETURN_TYPE_FLATTEN
public static final String RETURN_TYPE_UNFLATTEN
public static final AllowableValue FLATTEN_MODE_NORMAL
public static final AllowableValue FLATTEN_MODE_KEEP_ARRAYS
public static final AllowableValue FLATTEN_MODE_DOT_NOTATION
public static final AllowableValue FLATTEN_MODE_KEEP_PRIMITIVE_ARRAYS
public static final PropertyDescriptor SEPARATOR
public static final PropertyDescriptor FLATTEN_MODE
public static final PropertyDescriptor IGNORE_RESERVED_CHARACTERS
public static final PropertyDescriptor RETURN_TYPE
public static final PropertyDescriptor CHARACTER_SET
public static final PropertyDescriptor PRETTY_PRINT
public static final Relationship REL_SUCCESS
public static final Relationship REL_FAILURE
private List<PropertyDescriptor> properties
private Set<Relationship> relationships
protected void init(ProcessorInitializationContext context)
init in class AbstractSessionFactoryProcessorprotected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractConfigurableComponentpublic Set<Relationship> getRelationships()
getRelationships in interface ProcessorgetRelationships in class AbstractSessionFactoryProcessorpublic void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException
onTrigger in class AbstractProcessorProcessExceptionprivate com.github.wnameless.json.flattener.FlattenMode getFlattenMode(String mode)
private void setIgnoreReservedCharacters(boolean ignoreReservedCharacters,
com.github.wnameless.json.flattener.JsonFlattener jsonFlattener)
Copyright © 2023 Apache NiFi Project. All rights reserved.