As of today, you can pick and choose what fields you want to flatten and convert to CSV or SQL using JSON Path expressions.
What is JSON Path?
JSON paths are a very simple and intuitive way to reference any value in JSON documents, no matter how complex or nested it is. Think of it like CSS selectors, but for JSON.
This is how it works, as an example, if you had a document like this:
[
{
"name": "Christopher",
"age": "23",
},
{
"name": "Michael",
"age": "45",
}
]
You could extract the names of all the person records with this expression:
$.*.name
If you used this expression to convert to CSV, this would result in a file like this:
name
"Christopher"
"Michael"
This is very useful when you need to flatten very complex or large JSON documents, and you only want to extract a few fields, instead of the whole document.