Ana içeriğe geç

Adding New Key Expression and Removing Existing Key Expression

Input Value

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

JOLT Transformation Code

ipucu

In this example, first the Rating field is removed with remove operation, then the NewlyAddedField field is added with default operation.

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

Output Value

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