orjson — A fast json parser for python

Robby Boney
Short Bits
Published in
2 min readAug 30, 2021

--

“orjson is a fast, correct JSON library for Python. It benchmarks as the fastest Python library for JSON and is more correct than the standard json library or other third-party libraries. It serializes dataclass, datetime, numpy, and UUID instances natively.”
~orjson github readme

When to Use?

orjson and other alternative json parsers to the builtin json package in python’s standard library provide extra tooling for object serialization as well as significantly increased read\write speed making this an ideal tool where workload demands are higher.

Example

simple and familiar to json

Benchmarks

Its fast… like really fast.
https://github.com/ijl/orjson#performance

Some Numbers

  • serializes dataclass instances 40-50x as fast as other libraries
  • serializes datetime, date, and time instances to RFC 3339 format, e.g., "1970-01-01T00:00:00+00:00"
  • serializes numpy.ndarray instances 4-12x as fast with 0.3x the memory usage of other libraries

--

--

Robby Boney
Short Bits

Director of Product Development @ Interject Data Systems. I write Software for Science, Data & Enterprise… https://robbyboney.com/