jsonstringfieldjolt

Jolt Transform to empty field


I have the following example of JSON and there many other fields apart from these 3

[
  {
    "field1": "xyz",
    "field2": "mno",
    "res1": "pqrs"
  },
  {
    "field1": "xyz1",
    "field2": "mno1",
    "res1": "pqrs1"
    
  }..other entries
]

I would like to empty the contents of field res1.

I tried this

[
  {
    "operation": "default",
    "spec": {
      "*": {
        "*": {
          "res": ""
        }
      }
    }
  }
]

but it does not work. Please help in this case.

I use this site to test my Jolt Spec


Solution

  • Hi this spec will help you do it :

    If you want to empty res1 field as "res1": "". try this spec:

    [
      {
        "operation": "modify-overwrite-beta",
        "spec": {
          "*": {
            "res1": ""
          }
        }
      }
    ]
    

    If you want to remove res1 field as entirely. try this spec:

       [
          {
            "operation": "remove",
            "spec": {
              "*": {
                "res1": ""
              }
            }
          }
        ]