csv2json
csv2json copied to clipboard
can't convert Hash into String(TypeError)
Hi, I got an error, any idea?
$ json2csv 1.json
/usr/lib/ruby/1.8/csv.rb:326:in initialize': can't convert Hash into String (TypeError) from /usr/lib/ruby/1.8/csv.rb:326:in
open'
from /usr/lib/ruby/1.8/csv.rb:326:in open_writer' from /usr/lib/ruby/1.8/csv.rb:111:in
generate'
from /usr/local/bin/../lib/json2csv.rb:15:in `parse'
from /usr/local/bin/json2csv:69
the json file is:
[ { "thumbwidth": 75, "imgsrc": "paris_01.jpg", "thumbsrc": "paris_01.jpg", "height": 262, "imgpath": "images/", "thumbheight": 56, "thumbpath": "thumbnails/", "width": 350 }, { "thumbwidth": 75, "imgsrc": "paris_02.jpg", "thumbsrc": "paris_02.jpg", "height": 350, "imgpath": "images/", "thumbheight": 56, "thumbpath": "thumbnails/", "width": 262 } ]
Also it seems the json2csv is not in the Ruby gem package.
Can you try it with Ruby 1.9?