Support Questions

Find answers, ask questions, and share your expertise

add node in json array using Apache nifi

avatar
Explorer

field to add 

"quality" 

input json :

{
"json_data": {
"id": "1234",
"items": [
{
"id": "000000",
"metadata": {
"newId": "82896888047600"
}
}
]
}
}

 output json :

 

{
"json_data": {
"id": "1234",
"items": [
{
"id": "000000",
"metadata": {
"newId": "82896888047600",

"quality" :"good"
}
}
]
}
}

 

 

1 ACCEPTED SOLUTION

avatar
Super Guru

@sahil0915 ,

 

Please try the JoltTransformJSON processor with the following Chain specification:

[
  {
    "operation": "default",
    "spec": {
      "json_data": {
        "items[]": {
          "*": {
            "quality": "good"
          }
        }
      }
    }
  }
]

 

Cheers,

André

 

--
Was your question answered? Please take some time to click on "Accept as Solution" below this post.
If you find a reply useful, say thanks by clicking on the thumbs up button.

View solution in original post

1 REPLY 1

avatar
Super Guru

@sahil0915 ,

 

Please try the JoltTransformJSON processor with the following Chain specification:

[
  {
    "operation": "default",
    "spec": {
      "json_data": {
        "items[]": {
          "*": {
            "quality": "good"
          }
        }
      }
    }
  }
]

 

Cheers,

André

 

--
Was your question answered? Please take some time to click on "Accept as Solution" below this post.
If you find a reply useful, say thanks by clicking on the thumbs up button.