'Jolt Subtree Condition based on property of object exist or not

I have two types of json

{
   "parent": {
      "cType": "some type"
   }
}

&

{
   "parent": {
      "cType": {
         "label": "some label"
      }
   }
}

How to add condition check to verify property as per jolt spec such that ?

parent.cType = parent.cType.label or parent.cType

so that parent.cType has some value as per both jsons.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source