Integration / Apache NiFi Interview Questions
What is the difference between EvaluateJsonPath and FlattenJson processors?
EvaluateJsonPath and FlattenJson both work with JSON content but serve fundamentally different purposes.
EvaluateJsonPath extracts specific values from a JSON payload using JSONPath expressions and writes those values either to FlowFile attributes or to the FlowFile content. It is a targeted extraction tool — you specify exactly which fields you want and where they go. Configuration requires one or more User-Defined Properties, each mapping a JSONPath expression to a destination attribute name. The JSON content itself is typically not modified when writing to attributes.
FlattenJson takes a nested JSON object and flattens its entire structure into a single-level key-value object, using configurable separator characters to compose the flattened key names. For example:
Input: {"user": {"address": {"city": "Austin"}}} Output: {"user.address.city": "Austin"}
FlattenJson is used to normalize deeply nested JSON into flat structures suitable for systems that expect flat schemas (relational databases, Elasticsearch, CSV). It operates on the entire document, producing a new content FlowFile with the flattened JSON.
The choice: use EvaluateJsonPath when you need specific field values as attributes for routing or enrichment; use FlattenJson when you need to restructure the entire document hierarchy into a flat representation for downstream storage.
More Related questions...