danmandle / JSON2CSV

A simple PHP script to convert JSON data to CSV
142 stars 78 forks source link

json2csv #4

Open sonomilko opened 10 years ago

sonomilko commented 10 years ago

hello world :) i need to convert json google stream data to csv (or xml). here a sample of data: https://docs.google.com/spreadsheets/d/16TlohLsP0kv-cfoxnDO128ZcS_67rzObzAY4F6gorwg/gviz/tq

at the moment i'm able to create a script which download data to my pc, remove non-json info from header&footer of the stream and convert-it to csv, but the conversion isn't really orthodox :-) (the conversion need all the fields must be populated, not "null" value). i've noticed that exist a json2csv php script but really don't know how to use it. i've tryed to run the php script putting the json2csv.php inside www folder of my wamp installation: don't run.

could you show me a solution ? thx

peterchibunna commented 9 years ago

This json is not flat.

dracesh commented 7 years ago

how to save csv file in my current directory where i m having this script

felixyong92 commented 6 years ago

I tried to run the php files and convert my json files, the .csv i get is different and I did not make any changes to your code, but result seems different compared to the application in your blog at http://www.danmandle.com/blog/json-to-csv-conversion-utility/. Same Json file conducted the test, but the result it different.

I got this from the php files during testing: image

I got this from your blog application: image

I am still a beginner in php, hopefully i can get some guidance.

danmandle commented 6 years ago

@felixyong92 Looks like instead of using commas, your CSV is outputting semicolons.