简体   繁体   English

我应该在Rails 3.1项目中使用什么JSON gem?

[英]What JSON gem should I use in a Rails 3.1 project?

The release notes say: 发行说明说:

JSON decoding now uses the multi_json gem which also vendors a json engine called OkJson. JSON解码现在使用multi_json gem,它也提供一个称为OkJson的json引擎。 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. 已删除yaml后端,以支持OkJson作为1.8.x的默认引擎,而默认情况下将使用内置的1.9.x json实现。

Yet when I generate a new rails 3.1 project, Gemfile has the json gem, not the multi_json or OkJson gem. 但是,当我生成一个新的Rails 3.1项目时, Gemfile具有json gem,而不是multi_jsonOkJson 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. 此外,该发行说明听起来像内置了json支持,并且不需要与gem一起提供。

Also, I thought yajl-ruby was all-the-rage with the kids these days. 另外,我认为yajl-ruby如今在孩子们中风靡一时。

What does it all mean?? 这是什么意思呢??

Honestly, it depends on your needs. 老实说,这取决于您的需求。 What do you need JSON support for? 您需要JSON支持什么? Rails 3 does have JSON support baked in, but you might want something better for extremely large data sets. Rails 3确实内置了JSON支持,但您可能希望对超大型数据集有更好的选择。 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. 如果您只是接受JSON编码的帖子正文或为轻量级REST接口返回json数据,那么内置的内容可能会满足您的需求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM