These days I was playing with Sinatra, RestClient and HTTParty microframeworks for Ruby and from what I know, there is no automatic parsing for RestClient like in HTTParty, so I tried the following test by using all three of them:
Sinatra quick test:
require 'rubygems'
require 'sinatra'
get "/my/get" do
'{"response":{"error":false,"message":"Back to you from get"}}'
end
post "/my/post" do
'<response><error>false</error><message>Back to you from post</message></response>'
end
RestClient & HTTParty quick test:
(for httparty > 0.4.2)
require 'rubygems'
require 'rest_client'
require 'httparty'
include HTTParty
string_response = RestClient.get("http://localhost:4567/my/get")
response = Crack::JSON.parse(string_response)
p response
string_response = RestClient.post ("http://localhost:4567/my/post", {})
response = Crack::XML.parse(string_response)
p response
… so, we have the same objects from both JSON and XML responsess