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
[
{
"operation": "default",
"spec": {
"*": {
"*": {
"res": ""
}
}
}
}
]
but it does not work. Please help in this case.
I use this site to test my Jolt Spec
2
Answers
Hi this spec will help you do it :
If you want to empty res1 field as "res1": "".
try this spec:
If you want to remove res1 field as entirely.
try this spec:
Hi if you want to add a condition for res1 based on field1 field try this spec:
This means if field1 is either "/folder1/subfolder/name" or "/folder2/subfolder/name" or "/folder3/subfolder/name" then res1 value stay as it is else it will be removed.