0
votes

I want to achieve following JSON transformation using Jolt processor in NIFI The input in json, is a map (here image is a key and image1.png is a value, and etc, with different types (String, Boolean)

input JSON

{
  "internal_value": "434252345",
  "settings": {
    "image": "image1.png",
    "bold": false,
    "country": false
  }
}

Output JSON should be

{
  "internal_value": "434252345",
  "settings": {
    "image": "image1.png",
    "bold": "false",
    "country": "false"
  }
}

Is there a way to do this using existing Jolt operations ?

Thanks.

1

1 Answers

1
votes

As a pure JOLT this would be:

[
  {
    "operation": "modify-overwrite-beta",
    "spec": {
      "settings": {
        "bold": "=toString",
        "country": "=toString"
      }
    }
  }
]

You can use this tool to prototype JOLTs: https://jolt-demo.appspot.com/#inception

Resources:

JOLT transformation for nested JSON?

JOLT change string to float