Python — orjson

A fast JSON library for Python

Tony
Geek Culture

--

orjson is a JSON library, which can quickly and accurately complete the mutual conversion between Python objects and JSON formats. Compared with Python’s native JSON library and other third-party JSON libraries, orjson has richer functions and higher efficiency. Source code and more information about orjson : https://github.com/ijl/orjson

Introduction

First of all, let’s understand the advantages and disadvantages of orjson:

  • Datetime, date and time instances can be serialized to RFC 3339 format, for example: “2022–06–12T00:00:00+00:00”
  • Serializing numpy.ndarray instances is 4–12 times faster than other libraries, but uses less memory, about 1/3 of the other libraries
  • The output speed is 10 to 20 times faster than the standard library
  • The result of serialization is bytes, not str
  • When serializing str, unicode is not escaped to ASCII
  • Serialize float 10 times faster than other libraries and deserialize twice as fast as other libraries
  • Subclasses that can serialize str, int, list and dict directly
  • The load( ) and dump( ) methods are not provided. In the native JSON library, the load( ) method can convert…

--

--

No responses yet