Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > parsing json document

Reply
Thread Tools

parsing json document

 
 
vahag vardanyan
Guest
Posts: n/a
 
      03-04-2011
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/.

 
Reply With Quote
 
 
 
 
Karuppasamy M
Guest
Posts: n/a
 
      03-04-2011
[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 <(E-Mail Removed)>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/.
>
>


 
Reply With Quote
 
 
 
 
Anurag Priyam
Guest
Posts: n/a
 
      03-04-2011
> 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/

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lib to generate XML/JSON[P] output from a DTD/XSD/JSON Schema/etc Acácio Centeno Python 1 02-15-2013 07:34 AM
I am facing an issue while decoding json string using json.loads sajuptpm Python 2 12-28-2012 07:16 AM
[ANN] Security Fix json-1.1.7 for json_pure and json gems Florian Frank Ruby 0 06-30-2009 05:18 PM
"JSON for ASP" at json.org Tuğrul Topuz ASP General 1 06-27-2008 11:37 PM
parsing json output Gowri Python 9 03-27-2008 05:35 AM



Advertisments