katha alam
katha alam

Reputation: 11

Can i covert this in a CSV format where all the element gonna be under one row, without repeating the doc attribute?

[ { "doc": "ghgagsa", "element": [ { "firstName": "John", "lastName": "Doe" }, { "firstName": "Anna", "lastName": "Smith" }, { "firstName": "Peter", "lastName": "Jones" } ] }, { "doc": "ghgagsaaa", "element": [ { "firstName": "Joaahn", "lastName": "Doae" }, { "firstName": "Anana", "lastName": "Smiath" }, { "firstName": "Petaaer", "lastName": "Jonaes" } ] } ]

Upvotes: 0

Views: 22

Answers (1)

aborruso
aborruso

Reputation: 5728

Using jq, it's .[].element[]|[.firstName,.lastName]|@csv

Here an example https://jqplay.org/s/XmlRS6Yh9v

Upvotes: 0

Related Questions