Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 97 lines (78 sloc) 4.156 kB
d830026 @sferik Cleanup
sferik authored
1 MultiJSON
2 =========
3
4 Lots of Ruby libraries utilize JSON parsing in some form, and everyone has
5 their favorite JSON library. In order to best support multiple JSON parsers and
6 libraries, <tt>multi_json</tt> is a general-purpose swappable JSON backend
7 library. You use it like so:
8
9 require 'multi_json'
10
11 MultiJson.engine = :yajl
12 MultiJson.decode('{"abc":"def"}') # decoded using Yajl
13
14 MultiJson.engine = :json_gem
15 MultiJson.engine = MultiJson::Engines::JsonGem # equivalent to previous line
16 MultiJson.encode({:abc => 'def'}) # encoded using the JSON gem
17
18 The <tt>engine</tt> setter takes either a symbol or a class (to allow for
19 custom JSON parsers) that responds to both <tt>.decode</tt> and
20 <tt>.encode</tt> at the class level.
21
22 MultiJSON tries to have intelligent defaulting. That is, if you have any of the
23 supported engines already loaded, it will utilize them before attempting to
24 load any. When loading, libraries are ordered by speed. First Yajl-Ruby, then
25 the JSON gem, then JSON pure. If no JSON library is available, MultiJSON falls
26 back to a bundled version of [OkJson](https://github.com/kr/okjson).
27
f3c325e @sferik Add link to Travis CI
sferik authored
28 Continuous Integration
29 ----------------------
981d79e @sferik Use SSL-enabled build status image to avoid proxy caching
sferik authored
30 [![Build Status](https://secure.travis-ci.org/intridea/multi_json.png)](http://travis-ci.org/intridea/multi_json)
f3c325e @sferik Add link to Travis CI
sferik authored
31
d830026 @sferik Cleanup
sferik authored
32 Contributing
33 ------------
34 In the spirit of [free software](http://www.fsf.org/licensing/essays/free-sw.html), **everyone** is encouraged to help improve this project.
35
36 Here are some ways *you* can contribute:
37
38 * by using alpha, beta, and prerelease versions
39 * by reporting bugs
40 * by suggesting new features
41 * by writing or editing documentation
42 * by writing specifications
43 * by writing code (**no patch is too small**: fix typos, add comments, clean up inconsistent whitespace)
44 * by refactoring code
45 * by closing [issues](https://github.com/intridea/multi_json/issues)
46 * by reviewing patches
47
48 Submitting an Issue
49 -------------------
50 We use the [GitHub issue tracker](https://github.com/intridea/multi_json/issues) to track bugs and
51 features. Before submitting a bug report or feature request, check to make sure it hasn't already
52 been submitted. You can indicate support for an existing issuse by voting it up. When submitting a
53 bug report, please include a [Gist](https://gist.github.com/) that includes a stack trace and any
54 details that may be necessary to reproduce the bug, including your gem version, Ruby version, and
55 operating system. Ideally, a bug report should include a pull request with failing specs.
56
57 Submitting a Pull Request
58 -------------------------
59 1. Fork the project.
60 2. Create a topic branch.
61 3. Implement your feature or bug fix.
62 4. Add specs for your feature or bug fix.
63 5. Run <tt>bundle exec rake spec</tt>. If your changes are not 100% covered, go back to step 4.
64 6. Commit and push your changes.
65 7. Submit a pull request. Please do not include changes to the gemspec, version, or history file. (If you want to create your own version for some reason, please do so in a separate commit.)
66
d578eab @sferik Add section on Supported Rubies
sferik authored
67 Supported Rubies
68 ----------------
69 This library aims to support and is [tested
70 against](http://travis-ci.org/intridea/multi_json) the following Ruby
71 implementations:
72
73 * Ruby 1.8.7
74 * Ruby 1.9.1
75 * Ruby 1.9.2
76 * Ruby Enterprise Edition 1.8.7
77 * JRuby 1.6
78
79 If something doesn't work on one of these interpreters, it should be considered
80 a bug.
81
82 This library may inadvertently work (or seem to work) on other Ruby
83 implementations, however support will only be provided for the versions listed
84 above.
85
86 If you would like this library to support another Ruby version, you may
87 volunteer to be a maintainer. Being a maintainer entails making sure all tests
88 run and pass on that implementation. When something breaks on your
89 implementation, you will be personally responsible for providing patches in a
90 timely fashion. If critical issues for a particular implementation exist at the
91 time of a major release, support for that Ruby version may be dropped.
92
d830026 @sferik Cleanup
sferik authored
93 Copyright
94 ---------
95 Copyright (c) 2010 Michael Bleigh, Josh Kalderimis, Erik Michaels-Ober, and Intridea, Inc.
96 See [LICENSE](https://github.com/intridea/multi_json/blob/master/LICENSE.md) for details.
Something went wrong with that request. Please try again.