{"id":22498,"date":"2024-10-22T04:44:13","date_gmt":"2024-10-22T04:44:13","guid":{"rendered":"http:\/\/www.withdata.com\/blog\/?p=22498"},"modified":"2024-10-31T17:28:46","modified_gmt":"2024-10-31T17:28:46","slug":"convert-nested-json-to-csv","status":"publish","type":"post","link":"https:\/\/www.withdata.com\/blog\/use\/convert-nested-json-to-csv.html","title":{"rendered":"Convert nested JSON to CSV"},"content":{"rendered":"<p>I see a post <a href=\"https:\/\/stackoverflow.com\/questions\/69083312\/convert-nested-json-to-csv-or-table\">Convert nested JSON to CSV or table<\/a>, the poster have JSON data like this:<br \/>\nmenu1.json<\/p>\n<pre> {\"menu\": {\r\n  \"id\": \"file\",\r\n  \"value\": \"File\",\r\n  \"popup\": {\r\n    \"menuitem\": [\r\n      {\"value\": \"New\", \"onclick\": \"CreateNewDoc()\"},\r\n      {\"value\": \"Open\", \"onclick\": \"OpenDoc()\"},\r\n      {\"value\": \"Close\", \"onclick\": \"CloseDoc()\"}\r\n    ]\r\n  }\r\n}}\r\n<\/pre>\n<p>He want to convert it to CSV or table like this:<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.withdata.com\/images\/case\/nested-json-to-csv.png\" alt=\"nested json to csv\" width=\"464\" height=\"128\" style=\"max-width:100%;height:auto;display:block;\" \/><\/p>\n<p>I use <a href=\"https:\/\/www.withdata.com\/data-file-converter\/\">Data File Converter<\/a> to do this, in a minute.<\/p>\n<p>Just open JSON file in DataFileConverter, and set options like this:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.withdata.com\/images\/case\/nested-json-to-csv-source.png\" alt=\"convert nested json to csv\" width=\"722\" height=\"572\" style=\"max-width:100%;height:auto;display:block;\" \/><\/p>\n<p>And then &#8220;Next&#8221; and &#8220;Next&#8221;, convert, get the output CSV file.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I see a post Convert nested JSON to CSV or table, the poster have JSON data like this: menu1.json {&#8220;menu&#8221;: { &#8220;id&#8221;: &#8220;file&#8221;, &#8220;value&#8221;: &#8220;File&#8221;, &#8220;popup&#8221;: { &#8220;menuitem&#8221;: [ {&#8220;value&#8221;: &#8220;New&#8221;, &#8220;onclick&#8221;: &#8220;CreateNewDoc()&#8221;}, {&#8220;value&#8221;: &#8220;Open&#8221;, &#8220;onclick&#8221;: &#8220;OpenDoc()&#8221;}, {&#8220;value&#8221;: &#8220;Close&#8221;, &#8220;onclick&#8221;: &#8220;CloseDoc()&#8221;} ] } }} He want to convert it to CSV or table like this: [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3141],"tags":[34,1418,1498],"class_list":["post-22498","post","type-post","status-publish","format-standard","hentry","category-use","tag-csv","tag-json","tag-json-to-csv"],"_links":{"self":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/22498","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/comments?post=22498"}],"version-history":[{"count":1,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/22498\/revisions"}],"predecessor-version":[{"id":22499,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/22498\/revisions\/22499"}],"wp:attachment":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/media?parent=22498"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/categories?post=22498"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/tags?post=22498"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}