Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

but it does not work. Please help in this case.
https://jolt-demo.appspot.com/#inception – I use this 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": ""
          }
        }
      }
    ]
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading