Skip to main content

ValidateJson

Description

Validates the contents of FlowFiles against a configurable JSON Schema. See json-schema.org for specification standards. This Processor does not support input containing multiple JSON objects, such as newline-delimited JSON. If the input FlowFile contains newline-delimited JSON, only the first line will be validated.

Tags

JSON, schema, validation

Properties

In the list below required Properties are shown with an asterisk (*). Other properties are considered optional. The table also indicates any default values, and whether a property supports the NiFi Expression Language.

Display NameAPI NameDefault ValueAllowable ValuesDescription
Schema Access Strategy *Schema Access StrategyJSON Schema Property
  • Schema Name Property
  • JSON Schema Property
Specifies how to obtain the schema that is to be used for interpreting the data.
Schema Name *Schema Name${schema.name}Specifies the name of the schema to lookup in the Schema Registry property

Supports Expression Language, using FlowFile attributes and Environment variables.

This property is only considered if:
  • the property Schema Access Strategy has a value of SCHEMA_NAME_PROPERTY
JSON Schema Registry *JSON Schema RegistryController Service:
JsonSchemaRegistry

Implementations:
StandardJsonSchemaRegistry
Specifies the Controller Service to use for the JSON Schema Registry

This property is only considered if:
  • the property Schema Access Strategy has a value of SCHEMA_NAME_PROPERTY
JSON Schema *JSON SchemaA URL or file path to the JSON schema or the actual JSON schema content

This property is only considered if:
  • the property Schema Access Strategy has a value of SCHEMA_CONTENT_PROPERTY
JSON Schema Version *JSON Schema VersionDraft 2020-12
  • Draft 4
  • Draft 6
  • Draft 7
  • Draft 2019-09
  • Draft 2020-12
The JSON schema specification

This property is only considered if:
  • the property Schema Access Strategy has a value of SCHEMA_CONTENT_PROPERTY

Dynamic Properties

This component does not support dynamic properties.

Relationships

NameDescription
failureFlowFiles that cannot be read as JSON are routed to this relationship
invalidFlowFiles that are not valid according to the specified schema are routed to this relationship
validFlowFiles that are successfully validated against the schema are routed to this relationship

Reads Attributes

This processor does not read attributes.

Writes Attributes

NameDescription
json.validation.errorsIf the flow file is routed to the invalid relationship , this attribute will contain the error message resulting from the validation failure.

State Management

This component does not store state.

Restricted

Required PermissionExplanation
reference remote resourcesSchema configuration can reference resources over HTTP

Input Requirement

This component requires an incoming relationship.

System Resource Considerations

ScopeDescription
MEMORYValidating JSON requires reading FlowFile content into memory

See Also