Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 118 lines (92 sloc) 5.244 kB
f420d44 @sferik Only show status of master branch
sferik authored
1 # MultiJSON [![Build Status](https://secure.travis-ci.org/intridea/multi_json.png?branch=master)][travis] [![Dependency Status](https://gemnasium.com/intridea/multi_json.png?travis)][gemnasium]
33c7d78 @sferik Condense build status and dependency status [ci skip]
sferik authored
2
3 [travis]: http://travis-ci.org/intridea/multi_json
4 [gemnasium]: https://gemnasium.com/intridea/multi_json
5
93d8271 @sferik Update README and gemspec to include Oj
sferik authored
6 Lots of Ruby libraries parse JSON and everyone has their favorite JSON coder.
7 Instead of choosing a single JSON coder and forcing users of your library to be
8 stuck with it, you can use MultiJSON instead, which will simply choose the
9 fastest available JSON coder. Here's how to use it:
d830026 @sferik Cleanup
sferik authored
10
11 require 'multi_json'
12
93d8271 @sferik Update README and gemspec to include Oj
sferik authored
13 MultiJson.decode('{"abc":"def"}') #=> {"abc" => "def"}
14 MultiJson.decode('{"abc":"def"}', :symbolize_keys => true) #=> {:abc => "def"}
15 MultiJson.encode({:abc => 'def'}) # convert Ruby back to JSON
16 MultiJson.encode({:abc => 'def'}, :pretty => true) # encoded in a pretty form (if supported by the coder)
dca0e50 @bsiggelkow Added doco for pretty encoding
bsiggelkow authored
17
a1953a8 @sferik Add dependency status [ci skip]
sferik authored
18 The `engine` setter takes either a symbol or a class (to allow for custom JSON
19 parsers) that responds to both `.decode` and `.encode` at the class level.
d830026 @sferik Cleanup
sferik authored
20
21 MultiJSON tries to have intelligent defaulting. That is, if you have any of the
22 supported engines already loaded, it will utilize them before attempting to
93d8271 @sferik Update README and gemspec to include Oj
sferik authored
23 load any. When loading, libraries are ordered by speed. First Oj, then Yajl,
24 then the JSON gem, then JSON pure. If no other JSON library is available,
25 MultiJSON falls back to [OkJson][], a simple, vendorable JSON parser.
a1953a8 @sferik Add dependency status [ci skip]
sferik authored
26
27 [okjson]: https://github.com/kr/okjson
d830026 @sferik Cleanup
sferik authored
28
44e88f2 @Overbryd Updated README.md for NSJSONSerialization
Overbryd authored
29 ## Supported JSON Engines
30
93d8271 @sferik Update README and gemspec to include Oj
sferik authored
31 * [Oj](https://github.com/ohler55/oj) Optimized JSON by Peter Ohler
32 * [Yajl](https://github.com/brianmario/yajl-ruby) Yet Another JSON Library by Brian Lopez
33 * [JSON](https://github.com/flori/json) The default JSON gem with C-extensions (ships with Ruby 1.9)
34 * [JSON Pure](https://github.com/flori/json) A Ruby variant of the JSON gem
35 * [NSJSONSerialization](https://developer.apple.com/library/ios/#documentation/Foundation/Reference/NSJSONSerialization_Class/Reference/Reference.html) Wrapper for Apple's NSJSONSerialization in the Cocoa Framework (MacRuby only)
36 * [OkJson][okjson] A simple, vendorable JSON parser
44e88f2 @Overbryd Updated README.md for NSJSONSerialization
Overbryd authored
37
fa6f485 @sferik Don't anchor around headers [ci skip]
sferik authored
38 ## <a name="contributing"></a>Contributing
a1953a8 @sferik Add dependency status [ci skip]
sferik authored
39 In the spirit of [free software][free-sw], **everyone** is encouraged to help
40 improve this project.
41
42 [free-sw]: http://www.fsf.org/licensing/essays/free-sw.html
d830026 @sferik Cleanup
sferik authored
43
44 Here are some ways *you* can contribute:
45
46 * by using alpha, beta, and prerelease versions
47 * by reporting bugs
48 * by suggesting new features
49 * by writing or editing documentation
50 * by writing specifications
a1953a8 @sferik Add dependency status [ci skip]
sferik authored
51 * by writing code (**no patch is too small**: fix typos, add comments, clean up
52 inconsistent whitespace)
d830026 @sferik Cleanup
sferik authored
53 * by refactoring code
a1953a8 @sferik Add dependency status [ci skip]
sferik authored
54 * by closing [issues][]
d830026 @sferik Cleanup
sferik authored
55 * by reviewing patches
56
a1953a8 @sferik Add dependency status [ci skip]
sferik authored
57 [issues]: https://github.com/intridea/multi_json/issues
58
fa6f485 @sferik Don't anchor around headers [ci skip]
sferik authored
59 ## <a name="issues"></a>Submitting an Issue
a1953a8 @sferik Add dependency status [ci skip]
sferik authored
60 We use the [GitHub issue tracker][issues] to track bugs and features. Before
61 submitting a bug report or feature request, check to make sure it hasn't
62 already been submitted. You can indicate support for an existing issuse by
63 voting it up. When submitting a bug report, please include a [Gist][] that
64 includes a stack trace and any details that may be necessary to reproduce the
65 bug, including your gem version, Ruby version, and operating system. Ideally, a
66 bug report should include a pull request with failing specs.
67
68 [gist]: https://gist.github.com/
514eb63 @sferik Switch up Markdown syntax for headers [ci skip]
sferik authored
69
fa6f485 @sferik Don't anchor around headers [ci skip]
sferik authored
70 ## <a name="pulls"></a>Submitting a Pull Request
d830026 @sferik Cleanup
sferik authored
71 1. Fork the project.
72 2. Create a topic branch.
73 3. Implement your feature or bug fix.
74 4. Add specs for your feature or bug fix.
a1953a8 @sferik Add dependency status [ci skip]
sferik authored
75 5. Run `bundle exec rake spec`. If your changes are not 100% covered, go back
76 to step 4.
d830026 @sferik Cleanup
sferik authored
77 6. Commit and push your changes.
a1953a8 @sferik Add dependency status [ci skip]
sferik authored
78 7. Submit a pull request. Please do not include changes to the gemspec,
79 version, or history file. (If you want to create your own version for some
80 reason, please do so in a separate commit.)
d830026 @sferik Cleanup
sferik authored
81
fa6f485 @sferik Don't anchor around headers [ci skip]
sferik authored
82 ## <a name="versions"></a>Supported Ruby Versions
726ba3d @sferik Make status images more consistent [ci skip]
sferik authored
83 This library aims to support and is [tested against][travis] the following Ruby
d578eab @sferik Add section on Supported Rubies
sferik authored
84 implementations:
85
86 * Ruby 1.8.7
87 * Ruby 1.9.2
a1953a8 @sferik Add dependency status [ci skip]
sferik authored
88 * Ruby 1.9.3
89 * [JRuby][]
90 * [Rubinius][]
91 * [Ruby Enterprise Edition][ree]
44e88f2 @Overbryd Updated README.md for NSJSONSerialization
Overbryd authored
92 * [MacRuby][] (not tested on Travis CI)
a1953a8 @sferik Add dependency status [ci skip]
sferik authored
93
94 [jruby]: http://www.jruby.org/
95 [rubinius]: http://rubini.us/
96 [ree]: http://www.rubyenterpriseedition.com/
44e88f2 @Overbryd Updated README.md for NSJSONSerialization
Overbryd authored
97 [macruby]: http://www.macruby.org/
d578eab @sferik Add section on Supported Rubies
sferik authored
98
99 If something doesn't work on one of these interpreters, it should be considered
100 a bug.
101
102 This library may inadvertently work (or seem to work) on other Ruby
103 implementations, however support will only be provided for the versions listed
104 above.
105
106 If you would like this library to support another Ruby version, you may
107 volunteer to be a maintainer. Being a maintainer entails making sure all tests
108 run and pass on that implementation. When something breaks on your
109 implementation, you will be personally responsible for providing patches in a
110 timely fashion. If critical issues for a particular implementation exist at the
111 time of a major release, support for that Ruby version may be dropped.
112
fa6f485 @sferik Don't anchor around headers [ci skip]
sferik authored
113 ## <a name="copyright"></a>Copyright
d830026 @sferik Cleanup
sferik authored
114 Copyright (c) 2010 Michael Bleigh, Josh Kalderimis, Erik Michaels-Ober, and Intridea, Inc.
a1953a8 @sferik Add dependency status [ci skip]
sferik authored
115 See [LICENSE][] for details.
116
117 [license]: https://github.com/intridea/multi_json/blob/master/LICENSE.md
Something went wrong with that request. Please try again.