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
Broke nested JSON array with JOLT
Labels:
- Labels:
-
Apache NiFi
Explorer
Created ‎01-17-2023 02:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm looking for breaking nested JSON file and try to flat it to fit into a SQL database.
Current Json:
{
"content": {
"failedPerProductLineAndReason": {
"Product1": {
"Downsizing licenses is not allowed": 1
}
}
}
}
Expected outcome:
{
"ErrorType": "failedPerProductLineAndReason",
"product": "Product1",
"error": "Downsizing licenses is not allowed",
"quantity": 1
}
1 REPLY 1
Super Guru
Created ‎01-17-2023 11:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Not sure if you are looking for the exact thing but this should give you the expected output from the sample you provided:
[
// Flatten an array of photo objects into a prefixed
// soup of properties.
{
"operation": "shift",
"spec": {
"content": {
"*": {
"*": {
"*": {
"$": "error",
"$1": "product",
"$2": "ErrorType",
"@": "q"
}
}
}
}
}
}
]
If that helps, please accept solution. Thanks
