A JSON parser written in Python.
Project description
json_parser
An efficient JSON parser written in Python.
Installation
Install it via pip:
pip install json-parser
Usage
import json_parser
data = json_parser.parse('{"value": 42}')
print(data['value']) # 42
Benchmarks
Running it on this 25MB JSON file gave the following results:
>>> with open('large-file.json') as f:
... t = time.time()
... x = json.load(f)
... t = time.time() - t
... print(t, 'seconds')
...
0.6405608654022217 seconds
>>> with open('large-file.json') as f:
... t = time.time()
... y = json_parser.parse(f.read())
... t = time.time() - t
... print(t, 'seconds')
...
22.286625385284424 seconds
>>> x == y
True
So, it's about 34x slower than the builtin json
.
Which, is par for the course when it comes to pure python.
Testing
Clone the app and run the following:
pip install -e '.[dev]'
pytest
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
json_parser-1.2.0.tar.gz
(9.1 kB
view hashes)
Built Distribution
Close
Hashes for json_parser-1.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cba9a2da5c7514f485a408b05ad5272ba4d35db1a0188122163e6a0551d4ecfd |
|
MD5 | ca00df7774e8427469692f66dd61eda5 |
|
BLAKE2b-256 | 1048f4ae13abccddfa5eadb7332477f5a971cfd46f61bbeebbb7394a1bbf8460 |