azelix
azelix

Reputation: 1277

Transform JSON to custom format NIFI

I'm trying to transform a JSON with the following format :

{
    payload_encrypted: data,
    timestamp : 1469039049
}

I have already evaluated the JSON, now I need to use the attributes in my output of evaluatejsonpath to get this format :

1469039049,data

Are they any built in processors to do this transformation, or do I need to develop a Python script in executionscript processor ?

Upvotes: 2

Views: 1582

Answers (1)

Andy
Andy

Reputation: 14194

I would use EvaluateJsonPath with the destination set to flowfile-content and a single complex JsonPath expression to extract both values to a single result. This will generate a new flowfile with the content you are looking for. If for some reason you are not able to get both values with one expression, you can use two expressions to extract each individually and then use MergeContent to combine their contents into a single flowfile. If you need to do further text manipulation to meet an externally leveraged requirement, ReplaceText is a good tool.

Upvotes: 3

Related Questions