Giter VIP home page Giter VIP logo

csv2json's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

csv2json's Issues

rake fails

/usr/bin/ruby1.8 -I"lib:lib:test" "/usr/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake/rake_test_loader.rb" "test/test_csv2json.rb"
(in /home/hoffmanc/ocer/darwin-csv2json-0436af7)
All dependencies seem to be installed.
Loaded suite /usr/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake/rake_test_loader
Started
population_comma.csv
F
Finished in 0.024187 seconds.

  1. Failure:
    test: Csv2json should parse some test files. (TestCsv2json)
    [./test/test_csv2json.rb:18:in __bind_1269015901_504391' ./test/test_csv2json.rb:12:inopen'
    ./test/test_csv2json.rb:12:in __bind_1269015901_504391' ./test/test_csv2json.rb:9:inglob'
    ./test/test_csv2json.rb:9:in __bind_1269015901_504391' ./test/test_csv2json.rb:8:inchdir'
    ./test/test_csv2json.rb:8:in __bind_1269015901_504391' /usr/lib/ruby/gems/1.8/gems/shoulda-2.10.3/lib/shoulda/context.rb:362:incall'
    /usr/lib/ruby/gems/1.8/gems/shoulda-2.10.3/lib/shoulda/context.rb:362:in `test: Csv2json should parse some test files. ']:
    is not true.

1 tests, 1 assertions, 1 failures, 0 errors
rake aborted!
Command failed with status (1): [/usr/bin/ruby1.8 -I"lib:lib:test" "/usr/li...]

(See full trace by running task with --trace)

Dependency: ruby-dev

Hey Folks,

Running ubuntu 12.04. needed to do the following

$sudo apt-get install ruby-dev

Then, from the other depency issue listed

$sudo gem install orderedhash

For those of us NOT ruby developers some simple docs listing deps would be welcome.

Thanks for the tool

Missing orderedhash dependency

sudo gem install csv2json -v 0.3.0
csv2json input.csv
/usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- orderedhash (LoadError)
        from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /var/lib/gems/2.1.0/gems/csv2json-0.3.0/lib/csv2json.rb:4:in `<top (required)>'
        from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /var/lib/gems/2.1.0/gems/csv2json-0.3.0/bin/csv2json:6:in `<top (required)>'
        from /usr/local/bin/csv2json:23:in `load'
        from /usr/local/bin/csv2json:23:in `<main>'

Missing dependency?

I tried using csv2json, here is what i get:

/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- orderedhash     (LoadError)
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /var/lib/gems/1.9.1/gems/csv2json-0.3.0/lib/csv2json.rb:4:in `<top (required)>'
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /var/lib/gems/1.9.1/gems/csv2json-0.3.0/bin/csv2json:6:in `<top (required)>'
    from /usr/local/bin/csv2json:23:in `load'
    from /usr/local/bin/csv2json:23:in `<main>'

seems like a missing dependency to me, but im no rubyist =/ any ideas?

in `initialize': wrong number of arguments(2 for 0) (ArgumentError)

Received following error when running the example file.csv with csv2json-0.2.0 running on Ruby 1.9.3-p125

csv2json file.csv > file.json
/.rvm/gems/ruby-1.9.3-p125/gems/csv2json-0.2.0/lib/csv2json.rb:17:in initialize': wrong number of arguments(2 for 0) (ArgumentError) from /.rvm/gems/ruby-1.9.3-p125/gems/csv2json-0.2.0/lib/csv2json.rb:17:innew'
from /.rvm/gems/ruby-1.9.3-p125/gems/csv2json-0.2.0/lib/csv2json.rb:17:in parse' from /.rvm/gems/ruby-1.9.3-p125/gems/csv2json-0.2.0/bin/csv2json:62:inmodule:CSV2JSONRunner'
from /.rvm/gems/ruby-1.9.3-p125/gems/csv2json-0.2.0/bin/csv2json:8:in <top (required)>' from /.rvm/gems/ruby-1.9.3-p125/bin/csv2json:19:inload'
from /.rvm/gems/ruby-1.9.3-p125/bin/csv2json:19:in `

'

Doesn't accept stdin

This doesn't work although it should according to the documentation:
`cat test.csv | csv2json``

invalid byte sequence in UTF-8

I was getting an encoding error with a certain csv file "invalid byte sequence in UTF-8". Adding ":ISO-8859-1" when opening the file fixed my problem

if ARGV.size > 0
    IN = File.open(ARGV[0], "r:ISO-8859-1")

Support for separate csv-header file...

I have no real issue, but just wanted to mention that you already support a configuration where you keep the csv-headers in a separate file from the data (e.g. headers.csv), which often happens when the csv-generator does not include the headers in the csv-output.
By using a command line script like:

csv2json headers.csv file.csv > file.json

all works great.

You may want to mention that available option to your readme.

Thanks for the command line tool - life saver!
-Frank.

Compressed JSON support?

Is it possible that you could add support for the compressed JSON format?

I ran a 22 MB CSV through this today and the output was 90MB, With compressed JSON it would have been about 32MB

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: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.

wrong number of arguments(2 for 0) (ArgumentError)

$ csv2json file.csv > file.json
/data/rvm/gems/ruby-1.9.3-p545/gems/csv2json-0.2.0/lib/csv2json.rb:17:in initialize': wrong number of arguments(2 for 0) (ArgumentError) from /data/rvm/gems/ruby-1.9.3-p545/gems/csv2json-0.2.0/lib/csv2json.rb:17:innew'
from /data/rvm/gems/ruby-1.9.3-p545/gems/csv2json-0.2.0/lib/csv2json.rb:17:in parse' from /data/rvm/gems/ruby-1.9.3-p545/gems/csv2json-0.2.0/bin/csv2json:62:inmodule:CSV2JSONRunner'
from /data/rvm/gems/ruby-1.9.3-p545/gems/csv2json-0.2.0/bin/csv2json:8:in <top (required)>' from /data/rvm/gems/ruby-1.9.3-p545/bin/csv2json:23:inload'
from /data/rvm/gems/ruby-1.9.3-p545/bin/csv2json:23:in <main>' from /data/rvm/gems/ruby-1.9.3-p545/bin/ruby_executable_hooks:15:ineval'
from /data/rvm/gems/ruby-1.9.3-p545/bin/ruby_executable_hooks:15:in `

'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.