Options
- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
NiFi SplitJson, split json when expression condition is met and pass through when condition is not met
Labels:
- Labels:
-
Apache NiFi
Contributor
Created ‎01-21-2025 12:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
1 REPLY 1
Contributor
Created on ‎01-22-2025 09:13 AM - edited ‎01-22-2025 09:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To get the result I wanted this is the roundabout process I used. I would imagine there's a better way.
