Ultra fast JSON encoder and decoder for Python
Project description
UltraJSON
UltraJSON is an ultra fast JSON encoder and decoder written in pure C with bindings for Python 3.6+.
Install with pip:
python -m 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]""")
[{'key': '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("åäö")
'"\\u00e5\\u00e4\\u00f6"'
>>> ujson.dumps("åäö", ensure_ascii=False)
'"åäö"'
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 indentation ("pretty output") is enabled. Default is 0
(disabled):
>>> ujson.dumps({"foo": "bar"})
'{"foo":"bar"}'
>>> print(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 |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for ujson-4.2.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bff484c162bd77877bc9ae6333b0a684493037ce3c5d8b664e8339becf9ad139 |
|
MD5 | 36208161a5d6e410ce1db2623c0a42b1 |
|
BLAKE2b-256 | 0cb0cd9230c44073b10e9317093b0177e01f5591d60b83f204332440a083f98b |
Hashes for ujson-4.2.0-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d61ae7a505105a16220a4282dbd552bef76968203e5e4f5edfdbb03d3159e3a |
|
MD5 | d33715f288a8992251f15419792fcab5 |
|
BLAKE2b-256 | adc6627159226e0aba1cac8538cb2a7ec56709bd2b2ad637753e3ef712187d21 |
Hashes for ujson-4.2.0-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74961587e9c1682d3e04fe29e02b67ec9c88cb0c3406ad94cc617d04c6fa6db2 |
|
MD5 | fde35f4a122f501cd6828d322bffd4bb |
|
BLAKE2b-256 | 76f972ec70974e4e27719759d5c1cc00bbcb033eb8053a604b0abff9dcf2b216 |
Hashes for ujson-4.2.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd98d659365fb9271d9f9ba21160670ddfecb93deaec8a5350519a0ab3604654 |
|
MD5 | 047e88ed5682e10c7b3ca29b34b1ca45 |
|
BLAKE2b-256 | d4ed90770034e3c898bdd7813caa4b7aead7d5f3cecefbc29689a0182049390b |
Hashes for ujson-4.2.0-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68088596e237dcda862c1760d1feb2236a8cc36804507a9fcfaa3ed21442ff64 |
|
MD5 | ba205b209adf73bb5d4b5d8482e68d6e |
|
BLAKE2b-256 | ef9c50e2bca700f39c671576e6a4c2998688247dec86384443c3deea07f1120a |
Hashes for ujson-4.2.0-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0db1acd8dbbf120095ce4ab118585219066ea2860332df2385a435c585036cae |
|
MD5 | 433903bede5655402a5b0add138babd6 |
|
BLAKE2b-256 | 07dd314e1696071f4e246fa1275e470d54dc0ac394c7626eba706151a1606538 |
Hashes for ujson-4.2.0-cp310-cp310-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e8c30186eaa4f982b9b56cad30b173b71aac9d6a393d97cbcbc4ca805e87943 |
|
MD5 | b7d50553c0e3ad081f4eafe0fef5a191 |
|
BLAKE2b-256 | 28b467ca2afd445b0d3cc879400befd246bc1342daa8414b924b3cc55b69f6f1 |
Hashes for ujson-4.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0abc1526d32ebe2f2b6fefcf82b9ee8661da3f45ecac087beee6aeaa21b39ec |
|
MD5 | f97c5363a8a098ea419bec2dd6c88629 |
|
BLAKE2b-256 | fa7816dd1f5dafe5087a190102f2d78977cfe0963efcded3e98159be1d726096 |
Hashes for ujson-4.2.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7c8cffd9e45248569fa576d19b043951a3edc67cbee3dca2a6b77e6998cb1ec |
|
MD5 | f7d1a9b7f8d5ac6b2c67a1715c3a76d5 |
|
BLAKE2b-256 | bd7b37e17278b00efdee0ded6f300a40981e0c5ccf0091fb41ef38f5fff0e85b |
Hashes for ujson-4.2.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26ebe3ac1e0d18d58e11dbf7cdd0459adcefd5c025ede99be7fceae47bd1bfc6 |
|
MD5 | 3e0548e8bbb2a9d4a18753d9338c4e7a |
|
BLAKE2b-256 | 3ea107ac2353ae41175556118d2874c0fe7126c080768157ce421305d8666a36 |
Hashes for ujson-4.2.0-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02f5a6acc5aa5b054c32bdccd17064c2cbd07c81b3a49449589a4552888f1961 |
|
MD5 | a49e15008c852dd2254db7d5384191fa |
|
BLAKE2b-256 | 90142d622e3f131fb3c0b2a469bd5bb406839bc144e191d3cba9bb6af02e0020 |
Hashes for ujson-4.2.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7b2643b063f33e5e0d539cf2811793a7df9da525e63483f70c9262a343bd59d |
|
MD5 | f5a362dfec5a0af9d512404bfee448aa |
|
BLAKE2b-256 | c241227c29cee2a361582508bc5dd15242bd5e679d44aaa99be3d404011c9f29 |
Hashes for ujson-4.2.0-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26e299caa9bfc2e532e16de38de2af48cde48258922cda5efc0dd447d42692fc |
|
MD5 | cfeb1cd09d58d66d3e27f15e0d8f6471 |
|
BLAKE2b-256 | e2487d82eed55b0e164f6fb8efc9e66f01550d8ed1ac3d139c4a7b35f19c46d2 |
Hashes for ujson-4.2.0-cp39-cp39-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 535f1e5b336f7a0573da59bd9352e9cc6a93185bf4b1d96fb3379e07b4fc619a |
|
MD5 | 93ca84734f72bcb6e8557fa541571531 |
|
BLAKE2b-256 | 24e10c1a3ef960ef9b13b8b2c3cea3d9ff75bfba89fa5c5feff9ef993b2a70fb |
Hashes for ujson-4.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6182898d7031d083017f9be47c6d57f9c2155d9f4391b77ed6c020cab8e5a471 |
|
MD5 | 5014b310f9906765320fa5bc27cb12ae |
|
BLAKE2b-256 | 6e360d6b6e23fa65af8829f871edceb4791d671c3e584ce013ceee42df988933 |
Hashes for ujson-4.2.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf272e6302c62a42ed0125efcc1d891dd909bcfb3c6aa075d89de209b2b8e930 |
|
MD5 | b0e45674f9a5421f772c77433a956758 |
|
BLAKE2b-256 | dafeeb2edf06bd735beb8e76853264ae2cf8b983954cd95d1c51cff38efa3b9b |
Hashes for ujson-4.2.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a885675252e041e19cb92ff76419251fdd1ab4c2ca9766cb3ecfa6ae07884d2 |
|
MD5 | 9bd99ecffbf27622f3935c3ff24fd940 |
|
BLAKE2b-256 | 53edcbd50bcc23eedb3635c89e4af6d6bb0d4a349836f255d7e347d9072e19c3 |
Hashes for ujson-4.2.0-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab70a29914fc202f7c8f6353bb0622b91f878e2892e57a4c7293b341d5a85133 |
|
MD5 | e26817969c7dfecb9daca9bfc6465ae0 |
|
BLAKE2b-256 | 6789fd7f0bd3af18fc91d628832c32c17bc32ad6d89f70acf888f0460e5144a3 |
Hashes for ujson-4.2.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fae1e251d9f9362ebc4adbbb252d0f4a023f66f180390624826fcb1812b808e9 |
|
MD5 | 4f9afffc9497d8c9afaa36f889e3ea31 |
|
BLAKE2b-256 | 8014f26e583977a527f074dbf5254cd24f3a850e1f602a056e6bcca51356680d |
Hashes for ujson-4.2.0-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c53653a12f6ce67b12e7806c190cce1db09c75de31212a5a9adbdbd7a2aba116 |
|
MD5 | 6a29a81053fe03e7b30bd282017fa03c |
|
BLAKE2b-256 | ad247c3a2162145340608b2a11a22e4ea00a32ef9a6c17b889379a1e6e866630 |
Hashes for ujson-4.2.0-cp38-cp38-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f863b12d27867b733d380a9878fc8c3ad11d3aea8a3650c33e7a8c2a888e1eb |
|
MD5 | 7de953340d1368b3eb2a26e8330da7ce |
|
BLAKE2b-256 | 47467bed4489b945f275f64f1cbea1ce0c831784612dfa5ebd88a4a5e6b455b4 |
Hashes for ujson-4.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78f8da27231b20d589319f743bd65011862691c102922be85c9f27e40656a0f7 |
|
MD5 | c2a55c32a50507ead994d2f1e9bc017d |
|
BLAKE2b-256 | 5c73d3400ba29d63ded783e4dc77848ac977a8553334ec1310f374bcc15f6f86 |
Hashes for ujson-4.2.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50ddff58727cc4f90ade4c818884c4f0fbeeb1f78f764ab2b2bc89cf1f4db126 |
|
MD5 | ed118df01648cd2ec65a5bb653cf0717 |
|
BLAKE2b-256 | 17e755d18da755c04dd70a789325b9b1fa1ba933ef83a10b7a4b19b32533eb37 |
Hashes for ujson-4.2.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99322e08e53580867c9909637747343354b7028a8208dc5df3d09233c8f52c30 |
|
MD5 | 553ccbbe272f5d40de1fccd6ffe6a501 |
|
BLAKE2b-256 | 5a69683fdd7654a19e94960be0001bedbc0b7638f594880f19e7a0fc57e5cd13 |
Hashes for ujson-4.2.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 944dfdfae0cb4e4274a23e5070be913f7ff8f05666d8d143f2356cf873f9a77a |
|
MD5 | 709dae9ba9857234960364063f0c7ad8 |
|
BLAKE2b-256 | 78426fce38d8de48cadbd5654d66633b4cc9413788d830c3407fef20eda946c2 |
Hashes for ujson-4.2.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50f413177206373b3568dff28c091b2d8c9145e5e54b0a524d3823293d7a29b8 |
|
MD5 | 3562822099cbb52c1c31600d3f4b461f |
|
BLAKE2b-256 | 40f34863b1389271662279b71cb317c6816b1ddedba4f0f0d8b184251ac8b3ba |
Hashes for ujson-4.2.0-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6e27ff0f92c719de004b806d84f471fff0157679e57517092b8f89345eb3a79 |
|
MD5 | ad14c7a3741b21717922ac74aef9b350 |
|
BLAKE2b-256 | 6c5f98d8e5e4a4f0c1c09eee13b9166875785a89bdd9199735602fd9be8811a5 |
Hashes for ujson-4.2.0-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9a0252da73d8b69de60811252cbfde215d76ee6eea935a519e223353352026c |
|
MD5 | 6ca2f35d99827592875e9e4157febb3e |
|
BLAKE2b-256 | 8e1be2e1b8d8eeaeeec83e1cfad3997200e7c4580d799a0bd177e089d6a659e2 |
Hashes for ujson-4.2.0-cp37-cp37m-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b55dde52028f3c426197b9a928618fbb2b548172eb45824ddb19cdcdf8e493f9 |
|
MD5 | f96793694d925bba417687269fc1fc72 |
|
BLAKE2b-256 | daa80b5b282470aea69df1a07997d2dd5e7664f0eadeda7cd5826ecb8bd710c3 |
Hashes for ujson-4.2.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ec19982b7a40fb526b8ffd6edfff2c5c10556a54416d554c4bc83b1e4140a4c |
|
MD5 | fd849033db297d456ca538861d9b6f34 |
|
BLAKE2b-256 | 3408db27f044dc449b14b697455281fe97882b30ef09eb19581c9f01a2b61f8d |
Hashes for ujson-4.2.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bccfff9910fbe3dae6a17ec080c48fca0bfe939b18e4b2622122109d4d2570d |
|
MD5 | 5627cb06f6cd026fd3310da1b9d6b1f5 |
|
BLAKE2b-256 | 41f99f3713d7e936db33259a09ce0a1f10e691520d7f7b4f692424a89994bc2a |
Hashes for ujson-4.2.0-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3697cae44a92c2264cf307d4cdd9ea436faa75a009d35a4097362a6bbf221a1b |
|
MD5 | 356c8a450d8356a44d364375b3f3b1e1 |
|
BLAKE2b-256 | b49f7dad1d6b85c80d047253c6838e1e4ca23d6507566e837d64c99c1891fcaa |
Hashes for ujson-4.2.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ebc82847938e417092fd463e593da39a280fd12585b998e435a2a45bb7a33f7 |
|
MD5 | 835b4530d35cb61803e293d2a9ec21e6 |
|
BLAKE2b-256 | 619f2e6e9912c7a947fa6ef89c2326d38be2dc752035e18fbf7a62eb93a87045 |
Hashes for ujson-4.2.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bac42d0131740b6f1d2b6a15f770c1fef0db97d05aba8564f3c75bb59a9c91c7 |
|
MD5 | 78293a35fbcf79b4e5b1e8f35b2f6b97 |
|
BLAKE2b-256 | 0bd0dee30239f8fbb13a1a322b029d9d5eb5a22ec08c2852721b90c386837020 |
Hashes for ujson-4.2.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32f4340c8d6a34e7fa1f9447919ebd4b6256afef0965868d51ea3cdf0694a8f7 |
|
MD5 | f37360fc8095c67c95092996419ddf96 |
|
BLAKE2b-256 | 9564c90468547ec4666beb99ecdfd36d239dfb9383bb9c4668b8158d1b6bfebd |
Hashes for ujson-4.2.0-cp36-cp36m-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40235c3704ac7f29b24a7a785f856e1c45a567c8cd4b57a025f516733e358972 |
|
MD5 | 6fb2f73d5dc64f0d6ec72e3e1b6dc4a9 |
|
BLAKE2b-256 | 9e218e978afc562c704d0cad6b882b2116723de250bfc2577c609d58c315c4d1 |
Hashes for ujson-4.2.0-cp36-cp36m-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff0ae4b1dc70c3362b04f4127e228b17e84946de611f85b32f565b990762deaf |
|
MD5 | 463133bdda4d905552b48025f3420ef6 |
|
BLAKE2b-256 | 5b7d7d92ebbfdb5f3cc6945e10444db6b974147fb7478b39a564c32891b1857b |
Hashes for ujson-4.2.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | adca402a97b8388c378d92c55b2bf4e8402baa5dfa059a85870a41e2f142a0d0 |
|
MD5 | a04ffe33f6b6322c2032b0cbd5ef06fd |
|
BLAKE2b-256 | 9be466b2c32b20817409d2b0e1710658c4be822de161c37589bd38af06ddcb4e |
Hashes for ujson-4.2.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc9e2e6933ecec17a7d351116f555caee84b798076a4c5276ab1e8654c83bd90 |
|
MD5 | a43eea7e11dd4d12de3aeb684c981aeb |
|
BLAKE2b-256 | 5458cd495bab49ef08e9db9d0f257f3d6d41e4a4f544c8e20b9e6184c1a16e37 |
Hashes for ujson-4.2.0-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0076de81aadc287f025525969bbc1272703be92933e988e5663a76ec5863628f |
|
MD5 | 7bf153757c60734d785deaea58e95c71 |
|
BLAKE2b-256 | 7ddf8588351c08403911a7d033ac2982b542b2fa7ea91780cb8ab8a7f716dbbd |
Hashes for ujson-4.2.0-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42f8def3e44d880774f644b53b4701a46889a9506e3fdc191c314c9e2e9b2a38 |
|
MD5 | 8a800d381a48ea02e74147311029f449 |
|
BLAKE2b-256 | 9aeb406eb262f20ab4db22ed081d4643bb57aaf46f0516c17d86c526088234fd |