0
votes

[ { "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" } ] } ]

1
Suggest you format the JSON using editor. And please post the desired output for your sample data - also formatted using editor. - MyICQ

1 Answers

0
votes

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

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