0
votes

Hi I have following Json input but as you can see "sites" is coming as string but it is actually array of strings which is escaped with \

'''
{ "name":"test", "Id" : "123", "sites": "["BR","DM","LM","MC","WK","ZZ"]" } '''

What I need to transform above using Nifi is as follow

'''
{ "name":"test", "Id" : "123", "sites": ["BR","DM","LM","MC","WK","ZZ"] } ''' how we can do this?

1
You have the same input and output... - daggett
Where did you get this "json" from, since it's not correctly formatted? If you can't change from source side the way this json is build/encoded, you could use ReplaceText processors to remove the double quotes that are unwanted by using regex. - Fudgy

1 Answers

0
votes

You can use two ReplaceText processors, like here: enter image description here enter image description here

The first one will replace text "[ with [ while the second one will replace ]" with ]