From: "Jesús Gabriel y Galán" Date: 2010-09-01T00:24:25+09:00 Subject: Re: Can't convert string to integer On Tue, Aug 31, 2010 at 5:08 PM, Dennis Monsewicz wrote: > I am a newbie to Ruby so I apologize for my ignorance. > > I am trying to parse a JSON object but I keep getting the error of Can't > convert string to integer. > > json = JSON.parse(resp.body) > json['member_id'].to_i > > I have NO idea why this won't work! Thanks in advance for the help! Can you show us what resp.body is? The following works for me: irb(main):001:0> require 'json' => true irb(main):003:0> h = {'member_id' => 5, 'name' => 'test'} => {"name"=>"test", "member_id"=>5} irb(main):005:0> h.to_json => "{\"name\":\"test\",\"member_id\":5}" irb(main):006:0> json = JSON.parse(h.to_json) => {"name"=>"test", "member_id"=>5} irb(main):007:0> json["member_id"].to_i => 5 So, I think we need more info. Jesus.