From: hemant Date: 2009-01-24T12:41:56+09:00 Subject: Re: Desktop <-> Web On Sat, Jan 24, 2009 at 2:51 AM, Brian Candler wrote: > I also learned from the Sinatra list that there is a Rack middleware > module you can load which which will perform the parsing of JSON POST > data for you, so it just ends up in params. Tidy. > > http://groups.google.com/group/sinatrarb/msg/6579132bee5fc0b2 > > http://github.com/rack/rack-contrib/blob/44322288f263dda0743183529efe4e04a240e76c/lib/rack/contrib/post_body_content_type_parser.rb If sole purpose is to ferry back JSON back forth, one may have a look at: http://halcyon.rubyforge.org/ Also, why bother converting JSON to YAML on ruby side? Marshalling Ruby objects to JSON is equally easier. If you are using AR or something it already has support for that, otherwise JSON gem already comes with support for marshalling built-in types which can be easily extended to custom classes with to_json method.