Transform empty list to empty string in jolt

Viewed 36

The use case is sometimes I will get an empty list as the input and instead of getting null as output for some specs, I want either empty string or no output instead of null.

And if the input is not an empty list, I want the spec to transform the input and give the results.

Input:

[]

Specs:

[{
    "operation": "modify-overwrite-beta",
    "spec": {
      "*": {
        "comments": "Sample values."
      }
    }
},

  {
    "operation": "shift",
    "spec": {
      "*": {
        "a": "[&1].A",
        "b": "[&1].B",
        "c": "[&1].C",
        "comments": "[&1].comments"
      }
    }
  }
]

desired output:


Output received:

null

Is there a way to get nothing in the output if the input is empty list?

0 Answers
Related