Skip to content

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

@timchen86

Description

@timchen86

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions