Skip to content

reers/ReerJSON

Repository files navigation

ReerJSON

A faster version of JSONDecoder based on yyjson

Coverage: 88% SwiftPM compatible

ReerJSON is a really fast JSON parser, and it's inspired by ZippyJSON and Ananda.

⚠️Important: When measuring the performance of Swift libraries, make sure you're building in Release Mode. When building Swift code on DEBUG compilation, it can be 10-20x slower than equivalent code on RELEASE.

Benchmarks

JSONDecoder

iOS 17+

CleanShot 2025-09-18 at 14 31 41@2x

CleanShot 2025-09-18 at 14 33 30@2x

Lower than iOS 17

CleanShot 2025-09-18 at 14 37 04@2x

macOS

CleanShot 2025-09-18 at 13 40 05@2x

Tested with ReerJSON 0.3.0, ZippyJSON 1.2.15, IkigaJSON 2.3.2

Code for Benchmarks

Installation

Swift Package Manager

Add dependency in Package.swift or project Package Dependencies

.package(url: "https://github.com/reers/ReerJSON.git", from: "0.3.0"),

Depend on ReerJSON in your target.

.product(name: "ReerJSON", package: "ReerJSON" ),

Usage

Just replace JSONDecoder with ReerJSONDecoder wherever you want to use it. So instead of let decoder = JSONDecoder(), do let decoder = ReerJSONDecoder(), and everything will just work. This is because ReerJSONDecoder has the exact same API as JSONDecoder. Also, don't forget to add import ReerJSON in files where you use it.

Differences

Decoder Diff Foundation ReerJSON
JSON5
assumesTopLevelDictionary
Infinity and NaN ±Infinity, ±NaN ±Infinity, ±NaN, ±Inf and case-insensitive. See details

TODO

  • Add GitHub workflow for CI.
  • Support CodableWithConfiguration.
  • Support JSON5 decoding.
  • Implement ReerJSONEncoder.

License

This project is licensed under the MIT License. Portions of this project incorporate code from the following source code or test code:

See the LICENSE file for the full text of both licenses.

Acknowledgments

We would like to express our gratitude to the following projects and their contributors:

Special thanks to all the open-source contributors who made this project possible.