Can't convert String into Integer

Hi all,

Using Httparty, I get the following response

@parsed_reponse = > {“items” => {"@no" => “1”, “@type” => “book”,
@category” => “GENERAL” }}

when i use the following code to access “@no”, I am getting the
following error Can’t convert String into Integer

r = @response.parsed_response[“items”]["@no"]

can anyone help on this,

I do get Can’t convert String into Integer

or

undefined method `[]’ for nil:NilClass (NoMethodError)

can anyone explain this with an example

I’m curious to know what you get from these:

puts @response.inspect
puts @response.parsed_response.inspect
puts @response.parsed_response["items"].inspect

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs