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.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ujson-3.0.0.tar.gz | 7.1 MB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| ujson-3.0.0-cp38-cp38-win_amd64.whl | CPython 3.8 | CPython 3.8 | Windows x86-64 | Details |
| ujson-3.0.0-cp38-cp38-manylinux1_x86_64.whl | CPython 3.8 | CPython 3.8 | Linux glibc 2.5+ x86-64 | Details |
| ujson-3.0.0-cp38-cp38-manylinux1_i686.whl | CPython 3.8 | CPython 3.8 | Linux glibc 2.5+ x86-32 | Details |
| ujson-3.0.0-cp38-cp38-macosx_10_14_x86_64.whl | CPython 3.8 | CPython 3.8 | macOS 10.14+ x86-64 | Details |
| ujson-3.0.0-cp37-cp37m-win_amd64.whl | CPython 3.7 | CPython 3.7 pymalloc | Windows x86-64 | Details |
| ujson-3.0.0-cp37-cp37m-manylinux1_x86_64.whl | CPython 3.7 | CPython 3.7 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| ujson-3.0.0-cp37-cp37m-manylinux1_i686.whl | CPython 3.7 | CPython 3.7 pymalloc | Linux glibc 2.5+ x86-32 | Details |
| ujson-3.0.0-cp37-cp37m-macosx_10_14_x86_64.whl | CPython 3.7 | CPython 3.7 pymalloc | macOS 10.14+ x86-64 | Details |
| ujson-3.0.0-cp36-cp36m-win_amd64.whl | CPython 3.6 | CPython 3.6 pymalloc | Windows x86-64 | Details |
| ujson-3.0.0-cp36-cp36m-manylinux1_x86_64.whl | CPython 3.6 | CPython 3.6 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| ujson-3.0.0-cp36-cp36m-manylinux1_i686.whl | CPython 3.6 | CPython 3.6 pymalloc | Linux glibc 2.5+ x86-32 | Details |
| ujson-3.0.0-cp36-cp36m-macosx_10_14_x86_64.whl | CPython 3.6 | CPython 3.6 pymalloc | macOS 10.14+ x86-64 | Details |
| ujson-3.0.0-cp35-cp35m-win_amd64.whl | CPython 3.5 | CPython 3.5 pymalloc | Windows x86-64 | Details |
| ujson-3.0.0-cp35-cp35m-manylinux1_x86_64.whl | CPython 3.5 | CPython 3.5 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| ujson-3.0.0-cp35-cp35m-manylinux1_i686.whl | CPython 3.5 | CPython 3.5 pymalloc | Linux glibc 2.5+ x86-32 | Details |
| ujson-3.0.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.0.0.tar.gz
| Download URL | ujson-3.0.0.tar.gz |
|---|---|
| Size | 7.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e0199849d61cc6418f94d52a314c6a27524d65e82174d2a043fb718f73d1520d
|
|
BLAKE2b-256 checksum How to use checksums |
b63f66262b970bd7e9b536892219a71d3b1951b760f94320b7b0719295d3a7ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7
|
Release files / ujson-3.0.0-cp38-cp38-win_amd64.whl
| Download URL | ujson-3.0.0-cp38-cp38-win_amd64.whl |
|---|---|
| Size | 43.9 kB |
| Tags | CPython 3.8 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
c841a6450d64c24c64cbcca429bab22cdb6daef5eaddfdfebe798a5e9e5aff4c
|
|
BLAKE2b-256 checksum How to use checksums |
58817d43f4eaff741e38784c56ffb0981a594af039da1c467ff01723e429a9b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Release files / ujson-3.0.0-cp38-cp38-manylinux1_x86_64.whl
| Download URL | ujson-3.0.0-cp38-cp38-manylinux1_x86_64.whl |
|---|---|
| Size | 178.8 kB |
| Tags | CPython 3.8 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
0e2352b60c4ac4fc75b723435faf36ef5e7f3bfb988adb4d589b5e0e6e1d90aa
|
|
BLAKE2b-256 checksum How to use checksums |
dde64730117370801ca8098942d807a59936656d7efcd0380c0f897837b4fc09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Release files / ujson-3.0.0-cp38-cp38-manylinux1_i686.whl
| Download URL | ujson-3.0.0-cp38-cp38-manylinux1_i686.whl |
|---|---|
| Size | 170.0 kB |
| Tags | CPython 3.8 Linux glibc 2.5+ x86-32 |
|
SHA-256 checksum How to use checksums |
9c68557da3e3ad57e0105aceba0cce5f8f7cd07d207c3860e59c0b3044532830
|
|
BLAKE2b-256 checksum How to use checksums |
5972fe6e9156ee779eecf2d03f08eadeb7d4aee248a104e03b983b78c555ed95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Release files / ujson-3.0.0-cp38-cp38-macosx_10_14_x86_64.whl
| Download URL | ujson-3.0.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 |
a32f2def62b10e8a19084d17d40363c4da1ac5f52d300a9e99d7efb49fe5f34a
|
|
BLAKE2b-256 checksum How to use checksums |
a1eaec81b5e5f5fe89dad7011a053d07eb444b3f7e3ea32b246a5f1d9f8fd1cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Release files / ujson-3.0.0-cp37-cp37m-win_amd64.whl
| Download URL | ujson-3.0.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 |
c04d253fec814657fd9f150ef2333dbd0bc6f46208355aa753a29e0696b7fa7e
|
|
BLAKE2b-256 checksum How to use checksums |
909425c5cbb0c9cdd187d2cf7cbdb458f0646844814a5ebcc6724fabb1344022
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7
|
Release files / ujson-3.0.0-cp37-cp37m-manylinux1_x86_64.whl
| Download URL | ujson-3.0.0-cp37-cp37m-manylinux1_x86_64.whl |
|---|---|
| Size | 176.7 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
f854702a9aff3a445f4a0b715d240f2a3d84014d8ae8aad05a982c7ffab12525
|
|
BLAKE2b-256 checksum How to use checksums |
82f212ca7bfd7879f8ed1b53104f2a6751a7722d63b12951c91c61ff433e5170
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Release files / ujson-3.0.0-cp37-cp37m-manylinux1_i686.whl
| Download URL | ujson-3.0.0-cp37-cp37m-manylinux1_i686.whl |
|---|---|
| Size | 167.8 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-32 |
|
SHA-256 checksum How to use checksums |
bea2958c7b5bf4f191f0def751b6f7c8b208edb5f7277e21776329f2ca042385
|
|
BLAKE2b-256 checksum How to use checksums |
dc2dce81651622b97a92443c2b4148d1fbfaf96ef10bb6c6ebd312bfe07e4acd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Release files / ujson-3.0.0-cp37-cp37m-macosx_10_14_x86_64.whl
| Download URL | ujson-3.0.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 |
0f33359908df32033195bfdd59ba2bfb90a23cb280ef9a0ba11e5013a53d7fd9
|
|
BLAKE2b-256 checksum How to use checksums |
62e802c27e37eb4f5eff42dfbfe295542c80fe9eed8b2224cf5d651c2d8bf072
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7
|
Release files / ujson-3.0.0-cp36-cp36m-win_amd64.whl
| Download URL | ujson-3.0.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 |
f40bb0d0cb534aad3e24884cf864bda7a71eb5984bd1da61d1711bbfb3be2c38
|
|
BLAKE2b-256 checksum How to use checksums |
3bf3822ebfdc9462775e10620add2d7759737b53de99c42fa813eada6e916024
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.8
|
Release files / ujson-3.0.0-cp36-cp36m-manylinux1_x86_64.whl
| Download URL | ujson-3.0.0-cp36-cp36m-manylinux1_x86_64.whl |
|---|---|
| Size | 176.7 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
0379ffc7484b862a292e924c15ad5f1c5306d4271e2efd162144812afb08ff97
|
|
BLAKE2b-256 checksum How to use checksums |
120a35e07ebe48f0c2a23c316d92c2e26eade75e00a3df0758be57e7804bfbf0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Release files / ujson-3.0.0-cp36-cp36m-manylinux1_i686.whl
| Download URL | ujson-3.0.0-cp36-cp36m-manylinux1_i686.whl |
|---|---|
| Size | 167.8 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32 |
|
SHA-256 checksum How to use checksums |
3bd791d17a175c1c6566aeaec1755b58e3f021fe9bb62f10f02b656b299199f5
|
|
BLAKE2b-256 checksum How to use checksums |
1c6711b78144b994f30a2890d977bd62cbfb55ebc264274988dbbf9a8bb607c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Release files / ujson-3.0.0-cp36-cp36m-macosx_10_14_x86_64.whl
| Download URL | ujson-3.0.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 |
634c206f4fb3be7e4523768c636d2dd41cb9c7130e2d219ef8305b8fb6f4838e
|
|
BLAKE2b-256 checksum How to use checksums |
7718a360e21343740df91da284f7a341311826e56a1dccbfe99afdfaaf0d0b90
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.10
|
Release files / ujson-3.0.0-cp35-cp35m-win_amd64.whl
| Download URL | ujson-3.0.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 |
670018d4ab4b0755a7234a9f4791723abcd0506c0eed33b2ed50579c4aff31f2
|
|
BLAKE2b-256 checksum How to use checksums |
8dc63835ccafaa4933ba80010246286313b69ad0fb59e80fabb1addb8e2234d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.5.4
|
Release files / ujson-3.0.0-cp35-cp35m-manylinux1_x86_64.whl
| Download URL | ujson-3.0.0-cp35-cp35m-manylinux1_x86_64.whl |
|---|---|
| Size | 176.7 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
019a17e7162f26e264f1645bb41630f7103d178c092ea4bb8f3b16126c3ea210
|
|
BLAKE2b-256 checksum How to use checksums |
954edbbcfc0543c86c47ad98eccc5c17488b566ceeecbde3c3544a5e6d0dc20d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Release files / ujson-3.0.0-cp35-cp35m-manylinux1_i686.whl
| Download URL | ujson-3.0.0-cp35-cp35m-manylinux1_i686.whl |
|---|---|
| Size | 167.9 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-32 |
|
SHA-256 checksum How to use checksums |
154f778f0b028390067aaedce8399730d4f528a16a1c214fe4eeb9c4e4f51810
|
|
BLAKE2b-256 checksum How to use checksums |
db62e879debff1e0f9272793e39464738493de8090b539f3397a4382f6d9c0f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Release files / ujson-3.0.0-cp35-cp35m-macosx_10_14_x86_64.whl
| Download URL | ujson-3.0.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 |
0959a5b569e192459b492b007e3fd63d8f4b4bcb4f69dcddca850a9b9dfe3e7a
|
|
BLAKE2b-256 checksum How to use checksums |
5b0d66f231ec6e086bee9b43354bb77a186be0784df515af08a4fe8451964366
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.5.9
|