{"id":1542,"date":"2013-08-03T23:43:12","date_gmt":"2013-08-03T23:43:12","guid":{"rendered":"http:\/\/garysieling.com\/blog\/?p=1542"},"modified":"2013-08-03T23:43:12","modified_gmt":"2013-08-03T23:43:12","slug":"convert-a-javascript-object-to-a-csv-file","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/convert-a-javascript-object-to-a-csv-file\/","title":{"rendered":"Convert a Javascript object to a CSV file"},"content":{"rendered":"<p>The following will, print out a Javascript object as a string &#8211; edit as you see fit.<\/p>\n<pre lang=\"Javascript\">\nfunction csv(placesQueue) {\n  var str = 'latitude,longitude\\n'; \/\/ column headers\n  $.each(placesQueue, function(idx, x) {\n    str = str + x.geometry.location.jb + \",\" + x.geometry.location.kb + \"\\n\"\n  });\n  return str;\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The following will, print out a Javascript object as a string &#8211; edit as you see fit. function csv(placesQueue) { var str = &#8216;latitude,longitude\\n&#8217;; \/\/ column headers $.each(placesQueue, function(idx, x) { str = str + x.geometry.location.jb + &#8220;,&#8221; + x.geometry.location.kb + &#8220;\\n&#8221; }); return str; }<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4],"tags":[130,302],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/1542"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=1542"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/1542\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=1542"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=1542"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=1542"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}