I’m looking for breaking nested JSON file and trying to flatten them 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
}
2
Answers
Go inside the
Downsizing licenses is not allowed
and get its value by@
and get another keys you want by$
You can use $ wildcards incrementally nested within objects/attribute such as
as principally needed to extract the keys
the demo on the site http://jolt-demo.appspot.com/ is