In this example, adding a new key expression to the existing JSON data and deleting an existing key expression will be demonstrated.

Sample Original Message

{
  "Rating": 1,
  "SecondaryRatings": {
    "Design": 4,
    "Price": 2,
    "RatingDimension3": 1
  }
}
CODE

JOLT Code

[
  {
    "operation": "remove",
    "spec": {
      "Rating": ""
    }
  },
  {
    "operation": "default",
    "spec": {
      "NewlyAddedField": "123"
    }
  }
]

CODE


Sample Result Message

{
  "SecondaryRatings" : {
    "Design" : 4,
    "Price" : 2,
    "RatingDimension3" : 1
  },
  "NewlyAddedField" : "123"
}
CODE