Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 120 lines (93 sloc) 5.189 kb
f420d44 Erik Michaels-Ober 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 Erik Michaels-Ober 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 Erik Michaels-Ober 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 Erik Michaels-Ober Cleanup
sferik authored
10
11 require 'multi_json'
12
5634253 Alex Koppel Updated readme for the new load/dump syntax
arsduo authored
13 MultiJson.load('{"abc":"def"}') #=> {"abc" => "def"}
14 MultiJson.load('{"abc":"def"}', :symbolize_keys => true) #=> {:abc => "def"}
15 MultiJson.dump({:abc => 'def'}) # convert Ruby back to JSON
16 MultiJson.dump({:abc => 'def'}, :pretty => true) # encoded in a pretty form (if supported by the coder)
dca0e50 Bill Siggelkow Added doco for pretty encoding
bsiggelkow authored
17
527a058 Alex Koppel Restore line break in readme
arsduo authored
18 The `use` method, which sets the MultiJson adapter, takes either a symbol or a
19 class (to allow for custom JSON parsers) that responds to both `.load` and `.dump`
20 at the class level.
d830026 Erik Michaels-Ober Cleanup
sferik authored
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
93d8271 Erik Michaels-Ober Update README and gemspec to include Oj
sferik authored
24 load any. When loading, libraries are ordered by speed. First Oj, then Yajl,
25 then the JSON gem, then JSON pure. If no other JSON library is available,
26 MultiJSON falls back to [OkJson][], a simple, vendorable JSON parser.
a1953a8 Erik Michaels-Ober Add dependency status [ci skip]
sferik authored
27
28 [okjson]: https://github.com/kr/okjson
d830026 Erik Michaels-Ober Cleanup
sferik authored
29
44e88f2 Lukas Rieder Updated README.md for NSJSONSerialization
Overbryd authored
30 ## Supported JSON Engines
31
93d8271 Erik Michaels-Ober Update README and gemspec to include Oj
sferik authored
32 * [Oj](https://github.com/ohler55/oj) Optimized JSON by Peter Ohler
33 * [Yajl](https://github.com/brianmario/yajl-ruby) Yet Another JSON Library by Brian Lopez
34 * [JSON](https://github.com/flori/json) The default JSON gem with C-extensions (ships with Ruby 1.9)
35 * [JSON Pure](https://github.com/flori/json) A Ruby variant of the JSON gem
36 * [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)
37 * [OkJson][okjson] A simple, vendorable JSON parser
44e88f2 Lukas Rieder Updated README.md for NSJSONSerialization
Overbryd authored
38
55393aa Erik Michaels-Ober GitHub automatically inserts anchors [ci skip]
sferik authored
39 ## Contributing
a1953a8 Erik Michaels-Ober Add dependency status [ci skip]
sferik authored
40 In the spirit of [free software][free-sw], **everyone** is encouraged to help
41 improve this project.
42
43 [free-sw]: http://www.fsf.org/licensing/essays/free-sw.html
d830026 Erik Michaels-Ober Cleanup
sferik authored
44
45 Here are some ways *you* can contribute:
46
47 * by using alpha, beta, and prerelease versions
48 * by reporting bugs
49 * by suggesting new features
50 * by writing or editing documentation
51 * by writing specifications
a1953a8 Erik Michaels-Ober Add dependency status [ci skip]
sferik authored
52 * by writing code (**no patch is too small**: fix typos, add comments, clean up
53 inconsistent whitespace)
d830026 Erik Michaels-Ober Cleanup
sferik authored
54 * by refactoring code
a1953a8 Erik Michaels-Ober Add dependency status [ci skip]
sferik authored
55 * by closing [issues][]
d830026 Erik Michaels-Ober Cleanup
sferik authored
56 * by reviewing patches
57
a1953a8 Erik Michaels-Ober Add dependency status [ci skip]
sferik authored
58 [issues]: https://github.com/intridea/multi_json/issues
59
55393aa Erik Michaels-Ober GitHub automatically inserts anchors [ci skip]
sferik authored
60 ## Submitting an Issue
a1953a8 Erik Michaels-Ober Add dependency status [ci skip]
sferik authored
61 We use the [GitHub issue tracker][issues] to track bugs and features. Before
62 submitting a bug report or feature request, check to make sure it hasn't
e941c55 Erik Michaels-Ober GitHub removed voting on issues a while ago [ci skip]
sferik authored
63 already been submitted. When submitting a bug report, please include a [Gist][]
64 that includes a stack trace and any details that may be necessary to reproduce
65 the bug, including your gem version, Ruby version, and operating system.
66 Ideally, a bug report should include a pull request with failing specs.
a1953a8 Erik Michaels-Ober Add dependency status [ci skip]
sferik authored
67
68 [gist]: https://gist.github.com/
514eb63 Erik Michaels-Ober Switch up Markdown syntax for headers [ci skip]
sferik authored
69
55393aa Erik Michaels-Ober GitHub automatically inserts anchors [ci skip]
sferik authored
70 ## Submitting a Pull Request
36a5125 Erik Michaels-Ober Add links to pull request instructions [ci skip]
sferik authored
71 1. [Fork the repository.][fork]
72 2. [Create a topic branch.][branch]
73 3. Add specs for your unimplemented feature or bug fix.
74 4. Run `bundle exec rake spec`. If your specs pass, return to step 3.
75 5. Implement your feature or bug fix.
76 6. Run `bundle exec rake spec`. If your specs fail, return to step 5.
77 7. Run `open coverage/index.html`. If your changes are not completely covered
78 by your tests, return to step 3.
79 8. Add, commit, and push your changes.
80 9. [Submit a pull request.][pr]
81
82 [fork]: http://help.github.com/fork-a-repo/
83 [branch]: http://learn.github.com/p/branching.html
84 [pr]: http://help.github.com/send-pull-requests/
d830026 Erik Michaels-Ober Cleanup
sferik authored
85
55393aa Erik Michaels-Ober GitHub automatically inserts anchors [ci skip]
sferik authored
86 ## Supported Ruby Versions
726ba3d Erik Michaels-Ober Make status images more consistent [ci skip]
sferik authored
87 This library aims to support and is [tested against][travis] the following Ruby
d578eab Erik Michaels-Ober Add section on Supported Rubies
sferik authored
88 implementations:
89
90 * Ruby 1.8.7
91 * Ruby 1.9.2
a1953a8 Erik Michaels-Ober Add dependency status [ci skip]
sferik authored
92 * Ruby 1.9.3
93 * [JRuby][]
94 * [Rubinius][]
44e88f2 Lukas Rieder Updated README.md for NSJSONSerialization
Overbryd authored
95 * [MacRuby][] (not tested on Travis CI)
a1953a8 Erik Michaels-Ober Add dependency status [ci skip]
sferik authored
96
97 [jruby]: http://www.jruby.org/
98 [rubinius]: http://rubini.us/
44e88f2 Lukas Rieder Updated README.md for NSJSONSerialization
Overbryd authored
99 [macruby]: http://www.macruby.org/
d578eab Erik Michaels-Ober Add section on Supported Rubies
sferik authored
100
101 If something doesn't work on one of these interpreters, it should be considered
102 a bug.
103
104 This library may inadvertently work (or seem to work) on other Ruby
105 implementations, however support will only be provided for the versions listed
106 above.
107
108 If you would like this library to support another Ruby version, you may
109 volunteer to be a maintainer. Being a maintainer entails making sure all tests
110 run and pass on that implementation. When something breaks on your
111 implementation, you will be personally responsible for providing patches in a
112 timely fashion. If critical issues for a particular implementation exist at the
113 time of a major release, support for that Ruby version may be dropped.
114
55393aa Erik Michaels-Ober GitHub automatically inserts anchors [ci skip]
sferik authored
115 ## Copyright
d830026 Erik Michaels-Ober Cleanup
sferik authored
116 Copyright (c) 2010 Michael Bleigh, Josh Kalderimis, Erik Michaels-Ober, and Intridea, Inc.
a1953a8 Erik Michaels-Ober Add dependency status [ci skip]
sferik authored
117 See [LICENSE][] for details.
118
119 [license]: https://github.com/intridea/multi_json/blob/master/LICENSE.md
Something went wrong with that request. Please try again.