On Oct 25, 5:59 pm, "Rick Olson" <[EMAIL PROTECTED]> wrote:
> The goal with the Rails param parsers is to allow the same controller
> code to work with multiple formats (html forms, xml, json, yaml, etc).
>  Also, going with REST best practices would be nice too.  This
> question is what kept me from implementing this months ago, actually.


Looking at the back-and-forth, I have to see I don't see why the
bother for all the complexities.

The Rails way indicates that we go for the simpler solution. In this
case I'd have to say requiring the JSON item posted in to be an
object, not an array, at the outermost level, is clearly the simplest
option.

It allows the JSON to be parsed into the params hash in just the same
way as XML and HTML forms.

JSON is a flexible format with lots of exciting work being done around
it these days, but just as Rails is opinionated about the XML it will
automagically turn into a params hash, it should be picky about the
JSON it will automagically convert, especially if being picky allows
for a much simpler developer API.

None of this should stop someone from getting at the raw post body and
deserializing it themselves if they are inclined. If we can make it
easy for developers access the raw JSON, it should be provided in a
parallel fashion as accessing the raw XML or forms data.

Chris


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to