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 .
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.1.2.tar.gz
(8.1 kB
view hashes)
Built Distribution
Close
Hashes for json_parser-1.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbaf23c4e12002fc4df33805ae29f4cf9095c29dc082852560002e37bfe75ed3 |
|
MD5 | 58d7c0db798c2e64ca76ffba27292a7a |
|
BLAKE2b-256 | 71a0740ad0421610e121fc50dd696a9dff011224b90ee6ce9176fc9ea23b1460 |