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 7961357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:00:48+00:00 2026-06-04T05:00:48+00:00

I am trying to build a little app using the Foursquare API. require ‘rubygems’

  • 0

I am trying to build a little app using the Foursquare API.

require 'rubygems'
require 'rest-client'
require 'json'
require 'foursquare2'
require 'awesome_print'

client = Foursquare2::Client.new(:client_id => 'xxx', :client_secret => 'xxx')

response = client.search_venues(:ll => '36.142064,-86.816086', :query => 'nails')

This works great, however the response I get from the API is some what baffling!

[
    [0] "groups",
    [1] [
        [0] {
             "type" => "places",
             "name" => "Places",
            "items" => [
                [ 0] {
                            "id" => "4e24ce97fa76c80b5f5adfcc",
                          "name" => "The Nail Spa",
                       "contact" => {
                                 "phone" => "6152975895",
                        "formattedPhone" => "(615) 297-5895"
                    },
                      "location" => {
                            "address" => "2126 Abbot Martin Rd. Suite 102",
                        "crossStreet" => "at Green Hills Mall",
                                "lat" => 36.10713765714286,
                                "lng" => -86.817004,
                           "distance" => 3888,
                         "postalCode" => "37215",
                               "city" => "Nashville",
                              "state" => "TN",
                            "country" => "United States"
                    },
                    "categories" => [
                        [0] {
                                    "id" => "4bf58dd8d48988d10c951735",
                                  "name" => "Cosmetics Shop",
                            "pluralName" => "Cosmetics Shops",
                             "shortName" => "Beauty / Cosmetic",
                                  "icon" => "https://foursquare.com/img/categories/shops/beauty_cosmetic.png",
                               "parents" => [
                                [0] "Shops & Services"
                            ],
                               "primary" => true
                        }
                    ],
                      "verified" => false,
                         "stats" => {
                        "checkinsCount" => 103,
                           "usersCount" => 90,
                             "tipCount" => 5
                    },
                      "specials" => []
                },

The above is the first part of the response, a lot of data comes back.

Whats the best way in Ruby to pull out the pars you wanted. For example – If I wanted the Name of each of the results coming back?

The class of the response is Hashie::Mash which I have never seen before?

  • 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-06-04T05:00:48+00:00Added an answer on June 4, 2026 at 5:00 am

    Hashie gives you some sugar to play with Hashes (see https://github.com/intridea/hashie).

    To get the name of each result, something like this should do the trick:

    response.groups[0].items.each{|i| puts i.name}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to build a desktop app to use facebook api and get
Hey guys i'm trying to build a little app that pulls in the users
I'm trying to build a little calendar app sort of like Google Calendar. I'm
I'm a hobby programmer trying to build a client/server application suite, using Delphi XE.
I am trying to build a little javascript class for geocoding addresses trough Google
I am currently trying to build a little widget that will retrieve a list
I am trying to build my own little toolbox for Vista. One of the
I'm trying to build a small class-like container that will make it a little
I have a site I'm trying to build and I've hit one little snag
Maybe my question it's a little weird, but I'm trying to build a not-so-simple

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.