Hi, I've been trying to get this to work, but am not sure how to complete it.
From a previous SplitJson I have a queue of Flowfiles in these two formats.
{
"s_id": 1000,
"parent": 0,
"items": {
"2020": {
"s_id": 2020,
"parent": 1000
},
"2021": {
"s_id": 2021,
"parent": 1000
}
}
}
and
{
"s_id": 1001,
"parent": 0
}
I would like to un-nest them further to the Flowfiles.
{
"s_id": 1000,
"parent": 0
}
{
"s_id": 2020,
"parent": 1000
}
{
"s_id": 2021,
"parent": 1000
}
{
"s_id": 1001,
"parent": 0
}
I've tried another SplitJson with a JsonPath expression of $.items[*], however this throws a failure for the json where "items" doesn't exist.
Can someone please guide me on the steps and processors I should be using to complete this task?
Is it possible with some type of conditional statement in the SplitJson JsonPath expression?
Thank you for your help!