Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6321465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:09:15+00:00 2026-05-24T16:09:15+00:00

Firstly just a big Thanks to everyone on this site, I am using it

  • 0

Firstly just a big Thanks to everyone on this site, I am using it daily and learning loads! However I have become a little stuck on a problem.

What I am trying to do is to Parse the Google Places API into my own array format. I am using JSON to do this. If I use the below command on the command prompt I can get the right response: (i have changed a few things for privacy)

curl -e http://www.yoursire.com 'https://maps.googleapis.com/maps/api/place/search/json?location=51.50401607915134,-0.10931970886235831&radius=500&types=food&sensor=false&key=AIzaSyCj58SthZHL75a5asdadsNCtbB6fdDe8'

If I then take this idea into ruby I have tried a few different things to grab the data. Firstly I have tried to do the following

require 'rubygems'
require 'open-uri'

result = open("https://maps.googleapis.com/maps/api/place/search/json?location=51.50401607915134,-0.10931970886235831&radius=500&types=food&sensor=false&key=AIzaSyCj58SthZHLsdfsdf5sY0sNCtbB6fdDe8'").read

puts result

I get a hash error that looks like this:

{ "html_attributions" : [ ],"results" : [ ], "status" : "REQUEST_DENIED" }

I am running this locally, which may be an issue, because the of curl -e, but I always get an error

The second option I have been trying is this:

require 'ruby-gems'
require 'open-uri'
require 'json'

result = JSON.parse(open("https://maps.googleapis.com/maps/api/place/details/json?location=51.50401607915134,-0.10931970886235831&radius=500&types=food&sensor=false&key=AIzaSyCj58SthZHL75a5RQd5sY0sNCtbB6fdDe8").read)

puts result

Now I can’t even get this one to run as i get the error:

./json.rb:5: undefined method `search' for nil:NilClass (NoMethodError)
    from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from places.rb:3

So I cant even seem to get the JSON gem to work? I am trying to run this locally in code, make it work then port the idea over to the web using Rails, but I want to know exactly how it works (learning etc…) I think I know what to do with the data once I have it, but getting it and storing it seems a little problematic at the moment for me. I would appreciate any help any one can give me… even if its a “READ THIS”.

Please note I am only using puts result at the end as a test to see if it works!

Thanks

Charlie

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T16:09:16+00:00Added an answer on May 24, 2026 at 4:09 pm

    The error is coming from the include line. Are you sure you’ve got the correct JSON gem for your Ruby installation? Try deleting all the code and just require 'json'. If you still get the error (and I think you will) then that’s your problem.

    For the actual JSON parsing line, I’d recommend doing it like this – it’s cleaner and more idiomatic:

    url = 'https://maps.googleapis.com/maps/api/place/details/json?location=51.50401607915134,-0.10931970886235831&radius=500&types=food&sensor=false&key=AIzaSyCj58SthZHL75a5RQd5sY0sNCtbB6fdDe8'
    result = open(url) do |file|
      JSON.parse(file.read)
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Firstly I would just like to thank everyone for reading this and answering my
Firstly, this is going to sound like homework, but it ain't. Just a problem
Firstly I design the site & convert it into HTML using Twitter bootstrap. The
Firstly, great job on B4A. I've just started, and already have a small app
We serialize/deserialize XML using XStream... and just got an OutOfMemory exception. Firstly I don't
Firstly, please forgive me if I have asked this before (i suffer memory problems
Firstly apologies if this a very basic question, I'm just curious to know the
Firstly, I'm using Django. Django provides gzip middleware which works just fine. Nginx also
I have a big problem with exporting my table to Excel file format. Firstly
Firstly thanks in advance for your time looking at this question. I'm trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.