Skip to main content

UltraJSON

PyPI version Supported Python versions PyPI downloads GitHub Actions status Travis CI status DOI Code style: Black

UltraJSON is an ultra fast JSON encoder and decoder written in pure C with bindings for Python 3.5+.

To install it just run pip as usual:

$ pip install ujson

Usage

May be used as a drop in replacement for most other JSON parsers for Python:

>>> import ujson
>>> ujson.dumps([{"key": "value"}, 81, True])
'[{"key":"value"},81,true]'
>>> ujson.loads("""[{"key": "value"}, 81, true]""")
[{u'key': u'value'}, 81, True]

Encoder options

encode_html_chars

Used to enable special encoding of “unsafe” HTML characters into safer Unicode sequences. Default is False:

>>> ujson.dumps("<script>John&Doe", encode_html_chars=True)
'"\\u003cscript\\u003eJohn\\u0026Doe"'

ensure_ascii

Limits output to ASCII and escapes all extended characters above 127. Default is true. If your end format supports UTF-8 setting this option to false is highly recommended to save space:

>>> ujson.dumps(u"\xe5\xe4\xf6")
'"\\u00e5\\u00e4\\u00f6"'
>>> ujson.dumps(u"\xe5\xe4\xf6", ensure_ascii=False)
'"\xc3\xa5\xc3\xa4\xc3\xb6"'

escape_forward_slashes

Controls whether forward slashes (/) are escaped. Default is True:

>>> ujson.dumps("http://esn.me")
'"http:\/\/esn.me"'
>>> ujson.dumps("http://esn.me", escape_forward_slashes=False)
'"http://esn.me"'

indent

Controls whether indention (“pretty output”) is enabled. Default is 0 (disabled):

>>> ujson.dumps({"foo": "bar"})
'{"foo":"bar"}'
>>> ujson.dumps({"foo": "bar"}, indent=4)
{
    "foo":"bar"
}

Benchmarks

UltraJSON calls/sec compared to other popular JSON parsers with performance gain specified below each.

Test machine:

Linux 5.0.0-1032-azure x86_64 #34-Ubuntu SMP Mon Feb 10 19:37:25 UTC 2020

Versions:

  • CPython 3.8.2 (default, Feb 28 2020, 14:28:43) [GCC 7.4.0]

  • nujson : 1.35.2

  • orjson : 2.6.1

  • simplejson: 3.17.0

  • ujson : 2.0.2

ujson

nujson

orjson

simplejson

json

Array with 256 doubles

encode

22,082

4,282

76,975

5,328

5,436

decode

24,127

34,349

29,059

14,174

13,822

Array with 256 UTF-8 strings

encode

3,557

2,528

24,300

3,061

2,068

decode

2,030

2,490

931

406

358

Array with 256 strings

encode

39,041

31,769

76,403

16,615

16,910

decode

25,185

24,287

34,437

32,388

27,999

Medium complex object

encode

10,382

11,427

32,995

3,959

5,275

decode

9,785

9,796

11,515

5,898

7,200

Array with 256 True values

encode

114,341

101,039

344,256

62,382

72,872

decode

149,367

151,615

181,123

114,597

130,392

Array with 256 dict{string, int} pairs

encode

13,715

14,420

51,942

3,271

6,584

decode

12,670

11,788

12,176

6,743

8,278

Dict with 256 arrays with 256 dict{string, int} pairs

encode

50

54

216

10

23

decode

32

32

30

20

23

Dict with 256 arrays with 256 dict{string, int} pairs, outputting sorted keys

encode

46

41

8

24

Complex object

encode

533

582

408

431

decode

466

454

154

164

Metadata

Release files for ujson 3.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ujson 3.1.0
File Size Uploaded
ujson-3.1.0.tar.gz 7.1 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for ujson 3.1.0
File
ujson-3.1.0-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details
ujson-3.1.0-cp38-cp38-manylinux1_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.5+ x86-64 Details
ujson-3.1.0-cp38-cp38-manylinux1_i686.whl CPython 3.8 CPython 3.8 Linux glibc 2.5+ x86-32 Details
ujson-3.1.0-cp38-cp38-macosx_10_14_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.14+ x86-64 Details
ujson-3.1.0-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details
ujson-3.1.0-cp37-cp37m-manylinux1_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64 Details
ujson-3.1.0-cp37-cp37m-manylinux1_i686.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-32 Details
ujson-3.1.0-cp37-cp37m-macosx_10_14_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.14+ x86-64 Details
ujson-3.1.0-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details
ujson-3.1.0-cp36-cp36m-manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details
ujson-3.1.0-cp36-cp36m-manylinux1_i686.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32 Details
ujson-3.1.0-cp36-cp36m-macosx_10_14_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.14+ x86-64 Details
ujson-3.1.0-cp35-cp35m-win_amd64.whl CPython 3.5 CPython 3.5 pymalloc Windows x86-64 Details
ujson-3.1.0-cp35-cp35m-manylinux1_x86_64.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 Details
ujson-3.1.0-cp35-cp35m-manylinux1_i686.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-32 Details
ujson-3.1.0-cp35-cp35m-macosx_10_14_x86_64.whl CPython 3.5 CPython 3.5 pymalloc macOS 10.14+ x86-64 Details

Total release size: 8.9 MB

Release files / ujson-3.1.0.tar.gz

Download URL ujson-3.1.0.tar.gz
Size 7.1 MB
Tags Source
SHA-256 checksum
How to use checksums
00bda1de275ed6fe81817902189c75dfd156b4fa29b44dc1f4620775d2f50cf7
BLAKE2b-256 checksum
How to use checksums
4323c2362e88248c169a3ff3e2cbe2d6d6ba5345260658476479b6e8703d4274
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

Release files / ujson-3.1.0-cp38-cp38-win_amd64.whl

Download URL ujson-3.1.0-cp38-cp38-win_amd64.whl
Size 44.0 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
bf30ac68d8b2aed665589cfd3608e43d8cd6cb74cd5a9379ab9af9861c33a8be
BLAKE2b-256 checksum
How to use checksums
f22f71cea71e35e954b43635ccbbc19a7eedcb30591cfd4178b3d7d54dd24053
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

Release files / ujson-3.1.0-cp38-cp38-manylinux1_x86_64.whl

Download URL ujson-3.1.0-cp38-cp38-manylinux1_x86_64.whl
Size 178.0 kB
Tags CPython 3.8 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
8032ca897cfce113cb9ca7f07ff4c750afe18c605eeed2e09cf9b882c99fc76b
BLAKE2b-256 checksum
How to use checksums
206f729b2d2c1ceb7357861538fed6aa78d9fcf9ae923b96e2649a1526012d1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

Release files / ujson-3.1.0-cp38-cp38-manylinux1_i686.whl

Download URL ujson-3.1.0-cp38-cp38-manylinux1_i686.whl
Size 169.0 kB
Tags CPython 3.8 Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
0184ed23618ce3d793aaf9f5b3dd456cf719b930d3936fb39000589ed0bd2811
BLAKE2b-256 checksum
How to use checksums
94ac43c9464163524e65167872b0009add9b52167bde322e08f32c071497e69b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

Release files / ujson-3.1.0-cp38-cp38-macosx_10_14_x86_64.whl

Download URL ujson-3.1.0-cp38-cp38-macosx_10_14_x86_64.whl
Size 45.1 kB
Tags CPython 3.8 macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
a8194b778adf38ad679c62e2bb6cf71972ae91102e611e4bb31f625be6fb366a
BLAKE2b-256 checksum
How to use checksums
b8fecb11147ce90ef7619bc41dacf945be3ba661d9c65c8d3c4af033c7c96f25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

Release files / ujson-3.1.0-cp37-cp37m-win_amd64.whl

Download URL ujson-3.1.0-cp37-cp37m-win_amd64.whl
Size 43.5 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
7e7cdd8a42428cd2716cfe0a506e57168c6a02b8032478209cb4a8a12b8c2c4e
BLAKE2b-256 checksum
How to use checksums
a74b6045ef8e4745350fdeb4f2f735f0290ca41a7df60e3f55392d5c22ccb900
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.8

Release files / ujson-3.1.0-cp37-cp37m-manylinux1_x86_64.whl

Download URL ujson-3.1.0-cp37-cp37m-manylinux1_x86_64.whl
Size 175.8 kB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
c2be0d511e5dc302f190e510544c4d5fbbb4396632abe33b66e28dad26ea4325
BLAKE2b-256 checksum
How to use checksums
650ea7475d349508e2bf2e7187610f3ff9119e08423c3f6b551cff5302a78978
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

Release files / ujson-3.1.0-cp37-cp37m-manylinux1_i686.whl

Download URL ujson-3.1.0-cp37-cp37m-manylinux1_i686.whl
Size 166.8 kB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
3a049acf176dacbb79ee00b13a78fc2524c35c69400e34aa5f6ff0fc3fdbb1f0
BLAKE2b-256 checksum
How to use checksums
d6f09cdbc6c47db5c028afd60a9d56dd4b16f7206909f1227d31dc2fca8e6cc7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

Release files / ujson-3.1.0-cp37-cp37m-macosx_10_14_x86_64.whl

Download URL ujson-3.1.0-cp37-cp37m-macosx_10_14_x86_64.whl
Size 45.0 kB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
d3f28f64b33609be20f985baa72d43ccfdf87e50d47ca2791d26b9c2f348a35b
BLAKE2b-256 checksum
How to use checksums
b84f4b95ceeacb6095c09b49db293a10444bfc5bb670fd62575e0a3cb7fee17c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.8

Release files / ujson-3.1.0-cp36-cp36m-win_amd64.whl

Download URL ujson-3.1.0-cp36-cp36m-win_amd64.whl
Size 43.5 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
083778f4e64f90b4468e73e0baafcde0ab83bff85315d28a5b1287a3f5909e7f
BLAKE2b-256 checksum
How to use checksums
fda9e02977d03b3fb1f48ae62e2a65f30d37e2601abff4469efcc966f0c80d9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.8

Release files / ujson-3.1.0-cp36-cp36m-manylinux1_x86_64.whl

Download URL ujson-3.1.0-cp36-cp36m-manylinux1_x86_64.whl
Size 175.8 kB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
6a2fac9892996c3a46bd3fd8bbf739f19f85fc7ec9cdc11b014f76267c3ee76d
BLAKE2b-256 checksum
How to use checksums
be1a36ead6ae1bc3b82ea864ef87f8c8e1e06bec3a745dc65915f47b46f241d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

Release files / ujson-3.1.0-cp36-cp36m-manylinux1_i686.whl

Download URL ujson-3.1.0-cp36-cp36m-manylinux1_i686.whl
Size 166.8 kB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
ebe1bc9536b93c697f042b6c39ed602ad7edd5ef139eb167d9c8e36594b24546
BLAKE2b-256 checksum
How to use checksums
af57e8c8fa48582757337f8ecbeca656f6595cb9e6f78be2a68a0814f66efcec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

Release files / ujson-3.1.0-cp36-cp36m-macosx_10_14_x86_64.whl

Download URL ujson-3.1.0-cp36-cp36m-macosx_10_14_x86_64.whl
Size 45.0 kB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
f6e229fa9b7d8586f894d18a003703fea4620ff8e6d39c11499755ecec5b43fc
BLAKE2b-256 checksum
How to use checksums
cc124c46ae203e1f8eea8cdab8b10d3c63c288c8ec6cc50079cba584fbf7a971
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.6.11

Release files / ujson-3.1.0-cp35-cp35m-win_amd64.whl

Download URL ujson-3.1.0-cp35-cp35m-win_amd64.whl
Size 43.5 kB
Tags CPython 3.5 CPython 3.5 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
0789837e7156e07890f2461ec1d9dc2ea4ef7c76fd36e46955d811485daf83b9
BLAKE2b-256 checksum
How to use checksums
4b6f47e6561152bf3a17eac64b665ba62d3f6a7578988d9f6718e5c910fb54da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.5.4

Release files / ujson-3.1.0-cp35-cp35m-manylinux1_x86_64.whl

Download URL ujson-3.1.0-cp35-cp35m-manylinux1_x86_64.whl
Size 175.8 kB
Tags CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
b794a2ddba049daa1fe0f28c4652b54d0d06580e7d3bcae87b4c000fb242654f
BLAKE2b-256 checksum
How to use checksums
c07c8686b5553a78c728baaa64b5d1fcf9a4229547081fe6c6c8f825189ecb7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

Release files / ujson-3.1.0-cp35-cp35m-manylinux1_i686.whl

Download URL ujson-3.1.0-cp35-cp35m-manylinux1_i686.whl
Size 166.8 kB
Tags CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
d40d53aa679994624960b1c40bc451c5d9e3a0779f6a04146b417e220ce8f7d4
BLAKE2b-256 checksum
How to use checksums
ce09a3017c8eba0d140b7a0204d34614f72a8eb387bd9121286c7191ae695e5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

Release files / ujson-3.1.0-cp35-cp35m-macosx_10_14_x86_64.whl

Download URL ujson-3.1.0-cp35-cp35m-macosx_10_14_x86_64.whl
Size 45.0 kB
Tags CPython 3.5 CPython 3.5 pymalloc macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
585329c16eeb0992308545c7a05eee76c7f1c2042b08317aac64fef1e71e71a9
BLAKE2b-256 checksum
How to use checksums
f9ddf05a9d3c49aa6d4ce8a56975c1943ae08cb27af1eb8dbc4ae2ca3aff827f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.5.9

Release history Release notifications | RSS feed

5.9.0

65 release files

5.8.0

61 release files

5.5.0

65 release files

5.3.0

50 release files

5.1.0

50 release files

5.0.0

50 release files

4.3.0

44 release files

4.2.0

44 release files

4.1.0

21 release files

4.0.2

21 release files

This release

3.1.0 This release

17 release files

2.0.3

7 release files

2.0.2

7 release files

2.0.1

7 release files

2.0.0

1 release file

1.35

1 release file

1.34

2 release files

1.33

3 release files

1.30

4 release files

1.23

4 release files

1.22

4 release files

1.21

4 release files

1.19

3 release files

1.18

1 release file

1.15

1 release file

1.9

1 release file

1.8

1 release file

1.6

1 release file

1.4

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page