Json Straw
A simple library to read massive JSON files.
What is it for?
Working with large JSON files is hard. It normally requires you to load the entire file into memory and use the json library to parse it. The problem is that loading the whole file is a challenge with very large JSON.
To solve this problem jsonstraw will read the file line by line, parse a number of objects and return them as an iterator.
Example
Image we need to parse a large file like this:
{
"data": [
{
"name": "Bob",
"id": 0,
"role": "user"
},
{
"name": "Sue",
"id": 1,
"role": "user"
},
{
"name": "Alan",
"id": 2,
"role": "user"
}
// plus 10,000,000 more
]
}
We have a large JSON document with a list of data that we need to parse.
from jsonstraw import read_json_chunk
for output in read_json_chunk("large_file.json", key = 'data', chunk_size=1000):
assert len(output) == 1000
We can use an iterator to read the JSON file. It will parse each object, convert it to a dict and provide lists based on your chunk_size.
Metadata
Release files for jsonstraw 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jsonstraw-0.1.3.tar.gz | 4.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jsonstraw-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.7 kB
Release files / jsonstraw-0.1.3.tar.gz
| Download URL | jsonstraw-0.1.3.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27a025eff32a034b145a0b67b44283768f85ece03b96b350cd419480f8a913b0
|
|
BLAKE2b-256 checksum How to use checksums |
1d8c9564a22319286389a756413801f043935f84ced0782923b1142f2c414bf8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 24, 2025.
Transparency logRelease files / jsonstraw-0.1.3-py3-none-any.whl
| Download URL | jsonstraw-0.1.3-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d696a7d0c0b208c86e8f9d1c26d518628d10a9826c9e9dc9a59d3865120dc834
|
|
BLAKE2b-256 checksum How to use checksums |
7ef94ed021325c884f10026f012a892276d255d4492f7eff4657ad127e7a362a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 24, 2025.
Transparency log