skip to Main Content

I have a use case, where i need to drop a whole set of record if condition satisfied.

Input

{
  "Location": "IND",
  "Environment": "",
  "Climate": "Summer",
  "category": "City",
  "status": "De-Active"
}

Condition : If "status" is equals to "De-Active", the set of record should be dropped or "null"

Output

null

My specs is working just opposite 🙂

[
  {
    "operation": "shift",
    "spec": {
      "status": {
        "De-Active": {
          "@2": ""
        }
      }
    }
  }
]

2

Answers


  1. You can use this spec:

    [
      {
        "operation": "shift",
        "spec": {
          "status": {
            "De-Active": {
              "*": ""
            },
            "*": {
                "@3": ""
            }
          }
        }
      }
    ]
    
    Login or Signup to reply.
  2. You can use such a conditional along with a shift transformation spec

    [
      {
        "operation": "shift",
        "spec": {
          "status": {
            "De-Active": "",
            "*": { "@2": "" } // else case
          }
        }
      }
    ]
    

    the demoes on the site http://jolt-demo.appspot.com/ are :

    enter image description here

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search