a work on process

Improvements to Rails’ JSON Support

You are reading a post by James Stewart entitled Improvements to Rails’ JSON Support. It was posted on 18 March 2007 at 10:45 am.

You can find more posts by returning to the index.

Filed under: Notes
Tagged: , ,

I’m travelling at the moment, so posting has slowed down after three weeks of daily updates. Nevertheless I’ve just about managed to keep up with my newsreader and was pleased to see that some attention has been going into the JSON support in ActiveResource.

Previously parsing JSON that couldn’t be easily handled by the YAML parser was a bit of a pain. Now it’s simply a case of calling:

ActiveSupport::JSON.decode(json_string)

And the JSON param_parser I referenced in my “Versatile RESTful APIs Beyond XML” article no longer needs extra help. It’s simply:

ActionController::Base.param_parsers[Mime::JSON] = Proc.new do |data|
  ActiveSupport::JSON.decode(post)
end

Recommend this post:

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Related Posts

 

1 Comment »

  • Nice!! But still only on Edge :( In the meanwhile you shall keep json.rb around

    Comment by rgs — 30 July 2007 @ 12:37 pm

TrackBack URI

Leave a comment

Login Method

OpenID

Anonymous