parsing json document

Discussion in 'Ruby' started by vahag vardanyan, Mar 4, 2011.

  1. Hi))

    am just begening programming with ruby))
    but there is a problem with parsing json document
    for example I type

    require 'json'
    JSON.parse '[{"name": "mike"}]'

    and there is eror

    `require': no such file to load -- json (LoadError).

    I am not sudo in server, so I can't install any features.

    So how I can parse Json document in Ruby???


    sorru for bad English))))

    --
    Posted via http://www.ruby-forum.com/.
     
    vahag vardanyan, Mar 4, 2011
    #1
    1. Advertising

  2. [Note: parts of this message were removed to make it a legal post.]

    It's a common problem for beginners. :) You just include the 'rubygems' at
    beginning in you file. Then continue your json parsing work. All the best.

    irb(main):001:0> require 'json'
    LoadError: no such file to load -- json
    from (irb):1:in `require'
    from (irb):1

    // solution

    irb(main):002:0> require 'rubygems'
    => true
    irb(main):003:0> require 'json'
    => true






    On Fri, Mar 4, 2011 at 2:18 PM, vahag vardanyan <>wrote:

    > Hi))
    >
    > am just begening programming with ruby))
    > but there is a problem with parsing json document
    > for example I type
    >
    > require 'json'
    > JSON.parse '[{"name": "mike"}]'
    >
    > and there is eror
    >
    > `require': no such file to load -- json (LoadError).
    >
    > I am not sudo in server, so I can't install any features.
    >
    > So how I can parse Json document in Ruby???
    >
    >
    > sorru for bad English))))
    >
    > --
    > Posted via http://www.ruby-forum.com/.
    >
    >
     
    Karuppasamy M, Mar 4, 2011
    #2
    1. Advertising

  3. > Thanks!)) it's works on my computer))
    >
    > but on server the same problem with rubygems


    Maybe you don't have json gem installed there. Use the gem command to find.

    $ gem list json

    If you don't have root permissions, you can set Rubygems to install
    gems to your home directory. See manual. Or, use RVM on your server -
    you can install RVM for a particular user (in this case for yourself)
    or system wide.

    --
    Anurag Priyam
    http://about.me/yeban/
     
    Anurag Priyam, Mar 4, 2011
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Florian Frank
    Replies:
    0
    Views:
    259
    Florian Frank
    Jun 30, 2009
  2. sajuptpm
    Replies:
    2
    Views:
    377
    sajuptpm
    Dec 28, 2012
  3. Acácio Centeno
    Replies:
    1
    Views:
    302
    dieter
    Feb 15, 2013
  4. Bryan Britten
    Replies:
    9
    Views:
    286
    Bryan Britten
    May 28, 2013
  5. David Karr
    Replies:
    1
    Views:
    188
    David Karr
    Jun 17, 2013
Loading...

Share This Page