darwin / csv2json

A gem useful for converting CSV files to JSON from command-line
MIT License
167 stars 39 forks source link

can't convert Hash into String(TypeError) #6

Open timchen86 opened 11 years ago

timchen86 commented 11 years ago

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:inopen' from /usr/lib/ruby/1.8/csv.rb:326:in open_writer' from /usr/lib/ruby/1.8/csv.rb:111:ingenerate' 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.

harrigan commented 11 years ago

Can you try it with Ruby 1.9?