Estou procurando soluções para converter JSON em CSV. Parece que a maioria das soluções espera que o JSON seja um único objeto em vez de uma matriz de objetos.
Todas as soluções que tentei daqui parecem quebrar com minha entrada, que vem da ondulação deste site .
Como posso converter o JSON em um CSV com jq
ou outra ferramenta quando a entrada é uma matriz em vez de um objeto.
[
{
"id": "4",
"link": "https://pressbooks.online.ucf.edu/amnatgov/",
"metadata": {
"@context": "http://schema.org",
"@type": "Book",
"name": "American Government",
"inLanguage": "en",
"copyrightYear": "2016",
"disambiguatingDescription": "The content of this textbook has been developed and arranged to provide a logical progression from the fundamental principles of institutional design at the founding, to avenues of political participation, to thorough coverage of the political structures that constitute American government. The book builds upon what students have already learned and emphasizes connections between topics as well as between theory and applications. The goal of each section is to enable students not just to recognize concepts, but to work with them in ways that will be useful in later courses, future careers, and as engaged citizens. ",
"image": "https://pressbooks.online.ucf.edu/app/uploads/sites/4/2020/01/American-Government.png",
"isBasedOn": "https://ucf-dev.pb.unizin.org/pos2041",
"author": [
{
"@type": "Person",
"name": "OpenStax"
}
],
"datePublished": "2016-01-06",
"copyrightHolder": {
"@type": "Organization",
"name": "cnxamgov"
},
"license": {
"@type": "CreativeWork",
"url": "https://creativecommons.org/licenses/by/4.0/",
"name": "CC BY (Attribution)"
}
},
"_links": {
"api": [
{
"href": "https://pressbooks.online.ucf.edu/amnatgov/wp-json/"
}
],
"metadata": [
{
"href": "https://pressbooks.online.ucf.edu/amnatgov/wp-json/pressbooks/v2/metadata"
}
],
"self": [
{
"href": "https://pressbooks.online.ucf.edu/wp-json/pressbooks/v2/books/4"
}
]
}
}
]
Formato Desejado:
id, link, context, type, name, inLanguage, image, author_type, author_name, license_type, license_url, license_name