Skip to main content

Ultra fast JSON encoder and decoder for Python

Project description

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

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]

Benchmarks

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

Test machine:

Linux version 2.6.32-131.0.15.el6.x86_64

Versions:

  • ujson: 1.21

  • simplejson: 2.6.2

  • cjson: 1.05

  • yajl: 0.3.5

  • Python: Python 2.6.6 (r266:84292, Jul 20 2011, 10:22:43)

ujson

simplejson

cjson

yajl

Array with 256 utf-8 strings

Encode

4090,74

899,39

83,86

3189,86

4,55

48,78

1,28

Decode

863,29

586,15

201,61

352,48

1,47

4,28

2,45

Medium complex object

Encode

9750,37

1377,15

1512,06

3341,91

7,08

6,45

2,92

Decode

5576,75

4247,16

3587,83

2850,13

1,31

1,55

1,96

Array with 256 strings

Encode

17998,01

12954,46

8715,02

15924,35

1,39

2,07

1,13

Decode

14540,71

19696,13

14908,46

9547,14

0,74

0,98

1,52

Array with 256 doubles

Encode

2185,20

1466,87

1956,99

3421,10

1,49

1,12

0,64

Decode

16062,01

8990,50

9743,40

8331,74

1,79

1,65

1,93

Array with 256 True values

Encode

69767,60

25202,56

41145,99

64330,76

2,77

1,70

1,08

Decode

91416,02

56439,97

54918,09

42786,02

1,62

1,66

2,14

Array with 256 dict{string, int} pairs

Encode

11307,54

1830,45

2720,90

7725,56

6,18

4,16

1,46

Decode

8695,94

7572,89

6076,71

5231,32

1,15

1,43

1,66

Dict with 256 arrays with 256 dict

Encode

37,76

4,88

10,49

27,62

7,74

3,60

1,37

Decode

17,70

15,56

11,25

12,00

1,14

1,57

1,47

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ujson-1.23.zip (193.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ujson-1.23.win32-py3.2.exe (218.5 kB view details)

Uploaded Source

ujson-1.23.win32-py2.7.exe (218.5 kB view details)

Uploaded Source

ujson-1.23.win32-py2.6.exe (218.7 kB view details)

Uploaded Source

File details

Details for the file ujson-1.23.zip.

File metadata

  • Download URL: ujson-1.23.zip
  • Upload date:
  • Size: 193.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ujson-1.23.zip
Algorithm Hash digest
SHA256 6fc94fcbf6a6f56fd0814d1eadbfccf35e4215eeba647333ce59dcee03b589f3
MD5 e55986d2ebdaa0380e2f61e56d7cc9d8
BLAKE2b-256 0e4df834822b66f63112bec37a1565e903f9272b749da312f4a5911c1ccb408c

See more details on using hashes here.

File details

Details for the file ujson-1.23.win32-py3.2.exe.

File metadata

  • Download URL: ujson-1.23.win32-py3.2.exe
  • Upload date:
  • Size: 218.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ujson-1.23.win32-py3.2.exe
Algorithm Hash digest
SHA256 048fbcf294c8263adbfe03d133a3da68339678c57cf7120db4aa19b33503e11c
MD5 d7706afad36d42ac995b20434232ba1e
BLAKE2b-256 71697a285c31812c2f46f6747516c9f6a5cb025f7c8f8773bf75c91f1702ea43

See more details on using hashes here.

File details

Details for the file ujson-1.23.win32-py2.7.exe.

File metadata

  • Download URL: ujson-1.23.win32-py2.7.exe
  • Upload date:
  • Size: 218.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ujson-1.23.win32-py2.7.exe
Algorithm Hash digest
SHA256 fc1cf39dc28baa06d4a8693c487c0476ba23f6b59a08acbfb297b2b2b64d0d75
MD5 1b95d6d989459fa99738d99f46db8ae3
BLAKE2b-256 e8bbfd338b765f8b2197c2c6d8c45f0d4c359eb11658c7b3b6edca18a30501ae

See more details on using hashes here.

File details

Details for the file ujson-1.23.win32-py2.6.exe.

File metadata

  • Download URL: ujson-1.23.win32-py2.6.exe
  • Upload date:
  • Size: 218.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ujson-1.23.win32-py2.6.exe
Algorithm Hash digest
SHA256 cb9067dc0ea12d5a288a5956021af5ce9c0db3da5b4e76dc50a01f877cd4b2c2
MD5 6791a22e404f4b1ae9d585eb47299da3
BLAKE2b-256 3a990a259d958b5abb1d964e55bec6ad2518aa0579872d7eb4968c1b85c9f252

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page