title: Object Serialization and Deserialization for XML and JSON in Ruby (library)?
body: <p>I am looking for a way to serialize/deseialize an object from its xml/json representation.</p>
  
  <p>I am not concerned about xml namespaces.</p>
  
  <p>Is there anything in Ruby which allows me to do:</p>
  
  <pre><code>class Person
     attr :name, true
     attr :age, true
     attr :sex, true
  end
  
  person_xml =
  "&lt;Person&gt;
    &lt;name&gt;Some Name&lt;/name&gt;
    &lt;age&gt;15&lt;/age&gt;
    &lt;sex&gt;Male&lt;/male&gt;
  &lt;/Person&gt;"
  
  // and then do
  p = person_xml.deserialize(Person.class)
  // or something of that sort
  </code></pre>
  
  <p>Coming from a .Net background, I am looking for something which lets me consume/dispatch objects from restful web services.</p>
  
  <p>How do you consume webservices in rails? (xml and json). Using xpath/active resource seems a bit too verbose (even for a .Net person)</p>
  
  <p><strong>Using ruby 1.9.x, Rails 3.x</strong></p>
  
  <p>Thanks</p>