Ana içeriğe geç

Adding Key Value if Key Value is Not Found

This example will show how to add the key expression if the desired key value does not exist within existing JSON data.

Input Value

{
"statusCode": 200,
"statusDescription": "OK",
"numRows": 1,
"data": [
{
"data": {
"Alan1": "içerik1",
"Alan2": "içerik2",
"Alan3": 1,
"Alan4": "içerik3",
"Alan5": "içerik4",
"NewField": "test"
}
}
],
"elapsedTime": 1,
"errors": []
}

JOLT Specification

[
{
"operation": "modify-default-beta",
"spec": {
"data": {
"*": {
"data": {
"NewField": null,
"NewField2": null
}
}
}
}
}
]

Output Value

{
"statusCode": 200,
"statusDescription": "OK",
"numRows": 1,
"data": [
{
"data": {
"Alan1": "içerik1",
"Alan2": "içerik2",
"Alan3": 1,
"Alan4": "içerik3",
"Alan5": "içerik4",
"NewField": "test",
"NewField2": null
}
}
],
"elapsedTime": 1,
"errors": []
}