What JSON gem should I use in a Rails 3.1 project?
The release notes say:
开发者_StackOverflow中文版JSON decoding now uses the multi_json gem which also vendors a json engine called OkJson. The yaml backend has been removed in favor of OkJson as a default engine for 1.8.x, while the built in 1.9.x json implementation will be used by default.
Yet when I generate a new rails 3.1 project, Gemfile has the json gem, not the multi_json or OkJson gem.
Additionally, the release notes kind of make it sound like json support is built in and doesn't need to be provided with a gem.
Also, I thought yajl-ruby was all-the-rage with the kids these days.
What does it all mean??
Honestly, it depends on your needs. What do you need JSON support for? Rails 3 does have JSON support baked in, but you might want something better for extremely large data sets. If you are just accepting JSON-encoded post bodies or returning json data for a light-weight REST interface, then the baked in stuff will probably meet your needs.
精彩评论