Skip to main content

A Python wrapper to YAJL providing standard iterator interface to streaming JSON parsing

Project description

Ijson is a Python wrapper to YAJL which is a streaming SAX-like JSON parser. Ijson provides a standard Python iterator interface for it.

Usage

Basic usage:

from ijson import parse

f = urlopen('http://.../') # some huge JSON
parser = parse(f)
while True:
    event, value = parser.next()
    if event == 'start_map':
        while event != 'end_map':
            event, value = parser.next()
            if event == 'map_key' and value == 'title':
                event, value = parser.next()
                do_something_with(value)

Acknowledgements

Ijson was inspired by yajl-py wrapper by Hatem Nassrat. Though ijson borrows almost nothing from the actual yajl-py code it was used as an example of integration with yajl using ctypes.

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

ijson-0.2.0.tar.gz (3.3 kB view details)

Uploaded Source

File details

Details for the file ijson-0.2.0.tar.gz.

File metadata

  • Download URL: ijson-0.2.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ijson-0.2.0.tar.gz
Algorithm Hash digest
SHA256 42425ba8839a379e327a73f69c95c5bd6fd3a79ef8984045475ed99d3ef3ed6a
MD5 dcba42e78e12615985149d7cb38705bd
BLAKE2b-256 4399fd76222797252f9dcc74bfa69d1f0f7bfa77acca807dd004a25c2056ac05

See more details on using hashes here.

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