https://github.com/sferik/multi_json
A generic swappable back-end for JSON handling.
https://github.com/sferik/multi_json
Keywords from Contributors
activejob activerecord mvc rack rubygems rspec sinatra background-jobs sidekiq multithreading
Last synced: about 23 hours ago
JSON representation
Repository metadata
A generic swappable back-end for JSON handling.
- Host: GitHub
- URL: https://github.com/sferik/multi_json
- Owner: sferik
- License: mit
- Created: 2025-06-24T17:34:24.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2026-02-02T10:06:07.000Z (30 days ago)
- Last Synced: 2026-02-27T02:56:41.187Z (5 days ago)
- Language: Ruby
- Size: 719 KB
- Stars: 12
- Watchers: 3
- Forks: 4
- Open Issues: 0
- Releases: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
README.md
MultiJSON
Lots of Ruby libraries parse JSON and everyone has their favorite JSON coder.
Instead of choosing a single JSON coder and forcing users of your library to be
stuck with it, you can use MultiJSON instead, which will simply choose the
fastest available JSON coder. Here's how to use it:
require 'multi_json'
MultiJson.load('{"abc":"def"}') #=> {"abc" => "def"}
MultiJson.load('{"abc":"def"}', :symbolize_keys => true) #=> {:abc => "def"}
MultiJson.dump({:abc => 'def'}) # convert Ruby back to JSON
MultiJson.dump({:abc => 'def'}, :pretty => true) # encoded in a pretty form (if supported by the coder)
When loading invalid JSON, MultiJSON will throw a MultiJson::ParseError. MultiJson::DecodeError and MultiJson::LoadError are aliases for backwards compatibility.
begin
MultiJson.load('{invalid json}')
rescue MultiJson::ParseError => exception
exception.data # => "{invalid json}"
exception.cause # => JSON::ParserError: 795: unexpected token at '{invalid json}'
end
ParseError instance has cause reader which contains the original exception.
It also has data reader with the input that caused the problem.
The use method, which sets the MultiJSON adapter, takes either a symbol or a
class (to allow for custom JSON parsers) that responds to both .load and .dump
at the class level.
When MultiJSON fails to load the specified adapter, it'll throw MultiJson::AdapterError
which inherits from ArgumentError.
MultiJSON tries to have intelligent defaulting. That is, if you have any of the
supported engines already loaded, it will utilize them before attempting to
load any. When loading, libraries are ordered by speed. First fast_jsonparser,
then Oj, then Yajl, then the JSON gem. If no other JSON library is available,
MultiJSON falls back to OkJson, a simple, vendorable JSON parser.
Supported JSON Engines
- fast_jsonparser Fast JSON parser by Anil Maurya
- Oj Optimized JSON by Peter Ohler
- Yajl Yet Another JSON Library by Brian Lopez
- JSON The default JSON gem with C-extensions (ships with Ruby 1.9+)
- gson.rb A Ruby wrapper for google-gson library (JRuby only)
- JrJackson JRuby wrapper for Jackson (JRuby only)
- OkJson A simple, vendorable JSON parser
Supported Ruby Versions
This library aims to support and is tested against the following Ruby
implementations:
- Ruby 3.2
- Ruby 3.3
- Ruby 3.4
- JRuby 10.0 (targets Ruby 3.4 compatibility)
If something doesn't work in one of these implementations, it's a bug.
This library may inadvertently work (or seem to work) on other Ruby
implementations, however support will only be provided for the versions listed
above.
If you would like this library to support another Ruby version, you may
volunteer to be a maintainer. Being a maintainer entails making sure all tests
run and pass on that implementation. When something breaks on your
implementation, you will be responsible for providing patches in a timely
fashion. If critical issues for a particular implementation exist at the time
of a major release, support for that Ruby version may be dropped.
Versioning
This library aims to adhere to Semantic Versioning 2.0.0. Violations
of this scheme should be reported as bugs. Specifically, if a minor or patch
version is released that breaks backward compatibility, that version should be
immediately yanked and/or a new version should be immediately released that
restores compatibility. Breaking changes to the public API will only be
introduced with new major versions. As a result of this policy, you can (and
should) specify a dependency on this gem using the Pessimistic Version
Constraint with two digits of precision. For example:
spec.add_dependency 'multi_json', '~> 1.0'
Copyright
Copyright (c) 2010-2026 Erik Berlin, Michael Bleigh, Josh Kalderimis, and Pavel
Pravosud. See LICENSE for details.
Owner metadata
- Name: Erik Berlin
- Login: sferik
- Email:
- Kind: user
- Description: Maker, Breaker
- Website:
- Location: San Francisco
- Twitter: sferik
- Company: @twitter
- Icon url: https://avatars.githubusercontent.com/u/10308?u=5a2785be9d9bf021907c5c53dc1345edd137604c&v=4
- Repositories: 180
- Last ynced at: 2023-04-09T03:48:45.493Z
- Profile URL: https://github.com/sferik
GitHub Events
Total
- Delete event: 15
- Pull request event: 54
- Fork event: 2
- Issues event: 6
- Watch event: 8
- Issue comment event: 27
- Push event: 169
- Pull request review event: 6
- Pull request review comment event: 7
- Create event: 28
- Commit comment event: 4
Last Year
- Delete event: 15
- Pull request event: 54
- Fork event: 2
- Issues event: 6
- Watch event: 8
- Issue comment event: 27
- Push event: 169
- Pull request review event: 6
- Pull request review comment event: 7
- Create event: 28
- Commit comment event: 4
Committers metadata
Last synced: 2 days ago
Total Commits: 842
Total Committers: 60
Avg Commits per committer: 14.033
Development Distribution Score (DDS): 0.452
Commits in past year: 223
Committers in past year: 6
Avg Commits per committer in past year: 37.167
Development Distribution Score (DDS) in past year: 0.09
| Name | Commits | |
|---|---|---|
| Erik Berlin | s****k@g****m | 461 |
| Pavel Pravosud | p****l@p****m | 213 |
| Josh Kalderimis | j****s@g****m | 35 |
| Michael Bleigh | m****l@i****m | 15 |
| Jean Boussier | j****r@g****m | 11 |
| Daniel Berger | 7****6 | 10 |
| Romain Tartière | r****n@b****g | 8 |
| Guy Boertje | g****e@g****m | 5 |
| Diego Elio 'Flameeyes' Pettenò | f****s@g****m | 5 |
| Alex Koppel | a****x@a****m | 5 |
| Gustav Munkby | g****v@g****m | 4 |
| Joshua Peek | j****h@j****m | 4 |
| Lukas Rieder | l****r@g****m | 4 |
| Seth Vargo | s****o@g****m | 3 |
| Takanori Ishikawa | t****a@g****m | 3 |
| Trent Albright | t****t@g****m | 3 |
| Ulysse Buonomo | b****e@g****m | 3 |
| Ville Lautanala | l****s@g****m | 2 |
| Sam Stephenson | s****m@3****m | 2 |
| James A. Rosen | j****s@z****m | 2 |
| Igor Kapkov | i****k@m****m | 2 |
| Daniel Berger | d****r@c****m | 2 |
| Bill Siggelkow | b****w@m****m | 2 |
| Peter Marsh | p****h@g****m | 2 |
| Aaron Patterson | a****n@g****m | 1 |
| 284km | k****0@g****m | 1 |
| Andrew Pennebaker | a****r@g****m | 1 |
| Daniel Farina | d****a@m****m | 1 |
| Jorge Braz | j****e@t****m | 1 |
| Rex Chung | r****x@r****m | 1 |
| and 30 more... | ||
Committer domains:
- schito.me: 1
- picandocodigo.net: 1
- redningja.com: 1
- mobomo.com: 1
- orien.io: 1
- phlippers.net: 1
- susanpotter.net: 1
- bastelfreak.de: 1
- 7vn.ru: 1
- redhat.com: 1
- utilum.com: 1
- rorcraft.com: 1
- talkdesk.com: 1
- microsoft.com: 1
- mac.com: 1
- covermymeds.com: 1
- me.com: 1
- zendesk.com: 1
- 37signals.com: 1
- joshpeek.com: 1
- alexkoppel.com: 1
- blogreen.org: 1
- intridea.com: 1
- pravosud.com: 1
Issue and Pull Request metadata
Last synced: 3 days ago
Total issues: 11
Total pull requests: 41
Average time to close issues: 4 days
Average time to close pull requests: about 12 hours
Total issue authors: 9
Total pull request authors: 5
Average comments per issue: 2.55
Average comments per pull request: 0.29
Merged pull request: 28
Bot issues: 0
Bot pull requests: 0
Past year issues: 11
Past year pull requests: 41
Past year average time to close issues: 4 days
Past year average time to close pull requests: about 12 hours
Past year issue authors: 9
Past year pull request authors: 5
Past year average comments per issue: 2.55
Past year average comments per pull request: 0.29
Past year merged pull request: 28
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- byroot (2)
- sferik (2)
- joceyall30-cell (1)
- sandstrom (1)
- gravitystorm (1)
- totus (1)
- mehmetc (1)
- espen (1)
- tjatkowski (1)
Top Pull Request Authors
- sferik (29)
- byroot (8)
- joceyall30-cell (2)
- willnet (1)
- smortex (1)
Top Issue Labels
Top Pull Request Labels
- codex (29)
Package metadata
- Total packages: 2
-
Total downloads:
- rubygems: 2,114,228,214 total
- Total docker downloads: 4,727,615,250
- Total dependent packages: 2,382 (may contain duplicates)
- Total dependent repositories: 734,305 (may contain duplicates)
- Total versions: 130
- Total maintainers: 4
gem.coop: multi_json
A common interface to multiple JSON libraries, including fast_jsonparser, Oj, Yajl, the JSON gem (with C-extensions), gson, JrJackson, and OkJson.
- Homepage: https://github.com/sferik/multi_json
- Documentation: http://www.rubydoc.info/gems/multi_json/
- Licenses: MIT
- Latest release: 1.19.1 (published 2 months ago)
- Last Synced: 2026-03-01T09:03:55.689Z (3 days ago)
- Versions: 65
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 1,057,114,107 Total
- Docker Downloads: 2,363,807,625
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Downloads: 0.012%
- Average: 0.015%
- Docker downloads count: 0.049%
- Maintainers (4)
rubygems.org: multi_json
A common interface to multiple JSON libraries, including fast_jsonparser, Oj, Yajl, the JSON gem (with C-extensions), gson, JrJackson, and OkJson.
- Homepage: https://github.com/sferik/multi_json
- Documentation: http://www.rubydoc.info/gems/multi_json/
- Licenses: MIT
- Latest release: 1.19.1 (published 2 months ago)
- Last Synced: 2026-03-01T08:31:29.860Z (3 days ago)
- Versions: 65
- Dependent Packages: 2,382
- Dependent Repositories: 734,305
- Downloads: 1,057,114,107 Total
- Docker Downloads: 2,363,807,625
-
Rankings:
- Downloads: 0.009%
- Dependent repos count: 0.018%
- Dependent packages count: 0.023%
- Docker downloads count: 0.053%
- Average: 0.765%
- Stargazers count: 2.133%
- Forks count: 2.352%
- Maintainers (4)
Dependencies
- actions/checkout v4 composite
- ruby/setup-ruby v1 composite
- actions/checkout v4 composite
- ruby/setup-ruby v1 composite
- actions/checkout v4 composite
- ruby/setup-ruby v1 composite
- actions/checkout v4 composite
- ruby/setup-ruby v1 composite
- rubygems/configure-rubygems-credentials v1.0.0 composite
- actions/checkout v4 composite
- ruby/setup-ruby v1 composite
- gson >= 0.6
- jrjackson >= 0.4.18
- json ~> 2.0
- json_pure ~> 2.0
- rake >= 13.1
- rspec >= 3.13
- rubocop >= 1.62.1
- rubocop-performance >= 1.20.2
- rubocop-rake >= 0.6.0
- rubocop-rspec >= 2.27.1
- standard >= 1.35.1
Score: 29.225682690022158