Skip to main content

No project description provided

Project description

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.

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

jsonstraw-0.1.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

jsonstraw-0.1.2-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file jsonstraw-0.1.2.tar.gz.

File metadata

  • Download URL: jsonstraw-0.1.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for jsonstraw-0.1.2.tar.gz
Algorithm Hash digest
SHA256 2a52bff9e7a4a9f897c76210a2cf881425368abd4e44b7927725bea37fae39b0
MD5 5561ebef29c110fabecadfab11d1d05e
BLAKE2b-256 7702320d42e80704f5ac1fe3ec9dc4b61e7df5d127dbdbb102ebed86d4d341d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonstraw-0.1.2.tar.gz:

Publisher: tag.yml on Loqui-Tech/jsonstraw

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jsonstraw-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: jsonstraw-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for jsonstraw-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ac9f4b4ce1c672714ae53b109f37c0a76d9a7990131cf9a32be45ba4fd0fa8e3
MD5 9bda4ecaf8cd74b5e1d7101f62f09e53
BLAKE2b-256 c5b183831543605e5efce565ad7c4f1168c56741b94b61c521818f13d5f21ee5

See more details on using hashes here.

Provenance

The following attestation bundles were made for jsonstraw-0.1.2-py3-none-any.whl:

Publisher: tag.yml on Loqui-Tech/jsonstraw

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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