I want to write a JOLT definition that loops through each object in my data array, and move the object to the "found" array if the key "parent_id" is present, but otherwise, if the "parent_id" key is not present, move the entire current object to the "notfound" array.
Example input:
{
"data": [
{
"ID1": "ID1",
"ID2": "123"
},
{
"parent_id": "xyz",
"ID1": "ID1",
"ID2": "123"
}
]
}
Expected output:
{
"notfound": [
{
"ID1": "ID1",
"ID2": "123"
}
],
"found": [
{
"parent_id": "xyz",
"ID1": "ID1",
"ID2": "123"
}
]
}
I've tried my hand at making the JOLT definition, but everything i've tried hasn't really worked. Any help here would be greatly appreciated!