Flickr API Response

Hey,

I’ve been having this issue for a while now and need to get it resolved. I am querying the Flickr API and have set my response format to json but when I output the result onscreen via my app, parts of it are escaped. When I run the result through JSON.parse(), it returns valid yaml. How can I convert it to real json? Why isn’t the Flickr API returning it in the correct format?

When I run the call via Flickr’s own API testing points on it’s site, it shows valid json. So I have no idea what’s going wrong.

My Flickr class:

class Flickr

  require 'httparty'
  include HTTParty

  API_KEY         = '2e18ffffffaee'
  SECRET          = '88129735hj87y3ci32b2'
  USER_ID         = '5eifenf@9383'
  RESPONSE_FORMAT = 'json'
  base_uri          'http://api.flickr.com'

  # Get list of all collections
  def self.collections_list
    response = get("/services/rest/",
      :query => {
        method:          'flickr.collections.getTree',
        api_key:         API_KEY,
        user_id:         USER_ID,
        format:          RESPONSE_FORMAT,
        nojsoncallback:  1
      }
    )

    response.body

  end

Any ideas anyone?

Try JSON.parse(response.body).to_json where you need to output it in your app