Sure. Thank you.

Processor #1 creates this JSON

{
   "name":"this and that",
   "field":"value"
}

passes to Processor #2 which adds a record to a sub-field

{
   "name":"this and that",
   "field":"value",
   "others": [
      {"name":"here and there"}
    ]
}

passes to Processor #3 which also adds a record to "others".

{
   "name":"this and that",
   "field":"value",
   "others": [
      {"name":"here and there"},
      {"name":"one and two"},
    ]
}

which is the final output. So it's more building a JSON than transforming, 
sorta.
________________________________
From: Etienne Jouvin <lapinoujou...@gmail.com>
Sent: Tuesday, March 31, 2020 9:37 AM
To: users@nifi.apache.org <users@nifi.apache.org>
Subject: Re: Adding Nested Properties/JSON

Can you post example of input and expected result.

For adding, you can use default or modify-overwrite-beta

[https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif]<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
  Garanti sans virus. 
www.avast.com<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>

Le mar. 31 mars 2020 à 15:30, Darren Govoni 
<dar...@ontrenet.com<mailto:dar...@ontrenet.com>> a écrit :
Hi. Thank you.

In looking at the Jolt docs these are the operations:

shift, sort, cardinality, modify-default-beta, modify-overwrite-beta, 
modify-define-beta, or remove

I primarily need "add" such that I can add nested elements or add elements to 
an array already in the JSON.

Can a single Jolt processor do this? Or do I need to merge two inputs to join 
them into a single JSON?

thanks in advance!
Darren


________________________________
From: Etienne Jouvin <lapinoujou...@gmail.com<mailto:lapinoujou...@gmail.com>>
Sent: Tuesday, March 31, 2020 8:52 AM
To: users@nifi.apache.org<mailto:users@nifi.apache.org> 
<users@nifi.apache.org<mailto:users@nifi.apache.org>>
Subject: Re: Adding Nested Properties/JSON

Hello.

Jolt transformation.

Etienne

Le mar. 31 mars 2020 à 14:40, Darren Govoni 
<dar...@ontrenet.com<mailto:dar...@ontrenet.com>> a écrit :
Hi,
   I want to use Nifi to design a flow that modifies, updates, etc a nested 
JSON document (or that can finally output one at the end).

For example:

{
   "name":"this and that",
   "field":"value",
   "others": [
       {"name":"here and there"},
       ...
   ]
}

What's the best approach to this using Nifi?

Thanks in advance!
Darren

[https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif]<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
  Garanti sans virus. 
www.avast.com<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>

Reply via email to