4

Is there a way to generate XML from the configuration/programming used by the Rails AciveModelSerializer gem? AMS seems to only generate customized JSON. XML comes out in a default format.

I've seen references to AciveModelSerialization and that it supports JSON and XML, but the configuration, while similar, is different. What is the story with the difference between them? Is one going away? How do they compare in real use (other than format capability)?

George Shaw
  • 1,771
  • 1
  • 18
  • 32

1 Answers1

0

As you can see here, there (and at other spots), XML is slowly disappearing from the web. There are a couple of reasons for that. 1 - JSON objects are smaller. 2 - JSON is the de-facto format for most client-side javascript libraries. 3 - Fashion, people like it.

You can still use ActiveModel to serialize Xml if you wish so:

http://api.rubyonrails.org/classes/ActiveModel/Serializers/Xml.html

Hope it helps.

Community
  • 1
  • 1
muichkine
  • 2,890
  • 2
  • 26
  • 36