JSON paths are a very simple and intuitive way to reference elements in JSON documents, similar to CSS selectors, but for JSON.
This is how it works, 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
where:
-
$
references the root element, in this case an array -
*
is to repeat the expression, so it will match on each object of the array -
name
is to get the name property of the object
So if you used this expression to convert to CSV, this would result in:
name
Christopher
Michael
This is very useful when you need to flatten very complex JSON documents, and you only want to extract a few fields.
Go ahead and try our custom JSON to CSV conversion tool. Any feedback is welcome!
Top comments (3)
sqlify.io
is for sale.
LOL.
Hi Alejandro, Sqlify is alive and kicking, we just rebranded to konbert.com/
:)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.