@Tags(value={"json","tree","record","reader","parser"}) @CapabilityDescription(value="Parses JSON into individual Record objects. While the reader expects each record to be well-formed JSON, the content of a FlowFile may consist of many records, each as a well-formed JSON array or JSON object with optional whitespace between them, such as the common \'JSON-per-line\' format. If an array is encountered, each element in that array will be treated as a separate record. If the schema that is configured contains a field that is not present in the JSON, a null value will be used. If the JSON contains a field that is not present in the schema, that field will be skipped. See the Usage of the Controller Service for more information and examples.") @SeeAlso(value=JsonPathReader.class) public class JsonTreeReader extends SchemaRegistryService implements RecordReaderFactory
Modifier and Type | Field and Description |
---|---|
private boolean |
allowComments |
protected String |
dateFormat |
static PropertyDescriptor |
SCHEMA_APPLICATION_STRATEGY |
protected SchemaApplicationStrategy |
schemaApplicationStrategy |
static PropertyDescriptor |
STARTING_FIELD_NAME |
static PropertyDescriptor |
STARTING_FIELD_STRATEGY |
protected String |
startingFieldName |
protected StartingFieldStrategy |
startingFieldStrategy |
private com.fasterxml.jackson.core.StreamReadConstraints |
streamReadConstraints |
protected String |
timeFormat |
protected String |
timestampFormat |
schemaAccessStrategy
Constructor and Description |
---|
JsonTreeReader() |
buildStrategyProperty, customValidate, getConfigurationContext, getSchema, getSchema, getSchemaAccessStrategy, getSchemaAcessStrategyDescriptor, getSuppliedSchemaFields, storeSchemaAccessStrategy
abstractClearConfigContext, abstractStoreConfigContext, disabled, enabled, getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, getProperty, getStateManager, init, initialize, isEnabled
equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, toString, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
createRecordReader
initialize, isStateful
getIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate
protected volatile String dateFormat
protected volatile String timeFormat
protected volatile String timestampFormat
protected volatile String startingFieldName
protected volatile StartingFieldStrategy startingFieldStrategy
protected volatile SchemaApplicationStrategy schemaApplicationStrategy
private volatile boolean allowComments
private volatile com.fasterxml.jackson.core.StreamReadConstraints streamReadConstraints
public static final PropertyDescriptor STARTING_FIELD_STRATEGY
public static final PropertyDescriptor STARTING_FIELD_NAME
public static final PropertyDescriptor SCHEMA_APPLICATION_STRATEGY
protected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors
in class SchemaRegistryService
@OnEnabled public void storePropertyValues(ConfigurationContext context)
protected com.fasterxml.jackson.core.StreamReadConstraints buildStreamReadConstraints(ConfigurationContext context)
context
- Configuration Context with property valuesprotected boolean isAllowCommentsEnabled(ConfigurationContext context)
context
- Configuration Context with property valuesprotected List<AllowableValue> getSchemaAccessStrategyValues()
getSchemaAccessStrategyValues
in class SchemaRegistryService
protected SchemaAccessStrategy getSchemaAccessStrategy(String schemaAccessStrategy, SchemaRegistry schemaRegistry, PropertyContext context)
getSchemaAccessStrategy
in class SchemaRegistryService
protected RecordSourceFactory<com.fasterxml.jackson.databind.JsonNode> createJsonRecordSourceFactory()
protected AllowableValue getDefaultSchemaAccessStrategy()
getDefaultSchemaAccessStrategy
in class SchemaRegistryService
public RecordReader createRecordReader(Map<String,String> variables, InputStream in, long inputLength, ComponentLog logger) throws IOException, MalformedRecordException, SchemaNotFoundException
createRecordReader
in interface RecordReaderFactory
IOException
MalformedRecordException
SchemaNotFoundException
protected JsonTreeRowRecordReader createJsonTreeRowRecordReader(InputStream in, ComponentLog logger, RecordSchema schema) throws IOException, MalformedRecordException
IOException
MalformedRecordException
Copyright © 2023 Apache NiFi Project. All rights reserved.