Skip to main content

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)

Uploaded Source

Built Distribution

json_parser-1.1.2-py3-none-any.whl (10.1 kB view hashes)

Uploaded Python 3

Supported by

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