Satya Pavan
Satya Pavan

Reputation: 314

nifi append key value pair to a json flowfile

How can i append a key/value pair to a json flowfile in Nifi. I tried replaceText processor with replacement strategy as append but the key/value pair couldn't be inserted properly inside the JSON.

Upvotes: 1

Views: 2720

Answers (2)

Satya Pavan
Satya Pavan

Reputation: 314

You can do it using replaceText processor with replacement strategy as regex_replace.

Upvotes: 0

Bryan Bende
Bryan Bende

Reputation: 18630

I mentioned this on the other post, but you'll need to use a processor that understands JSON. You can use UpdateRecord for this... it would require that your schema has the extra field which you can make nullable so that the same schema can be used from the beginning, or you can have a second copy of the schema the reader in UpdateRecord would use the schema with 10 fields and the writer would use the schema with 11 fields.

Upvotes: 2

Related Questions