--- id: jsonstreams version: "0.6.0" license: MIT license_treatment: permissive maintenance: dormant --- # jsonstreams — A JSON streaming writer License: permissive · Maintenance: dormant · Downloads: 169.6K/mo ## What it is and what it does jsonstreams is a JSON writer that lets you build and output JSON documents incrementally without loading the entire structure into memory first. Instead of constructing nested dicts and lists and then serializing them with the standard json module, you write key-value pairs and nested structures directly to a file or stream using a context-manager interface. This is useful when generating large JSON files or when data arrives incrementally. The package treats JSON arrays and objects as first-class streaming containers, mirroring Python's list and dict semantics. It supports any type that the standard json.JSONEncoder can handle, or you can subclass the encoder for custom types. The context-manager design ensures containers are properly closed; writing to a closed container raises an exception to catch programming errors early. Use it for: - Generate large JSON files without loading all data into memory at once - Stream JSON output from a database query or API response incrementally - Build JSON documents where data arrives in chunks or from multiple sources - Write JSON logs or metrics where each entry is added one at a time - Reduce peak memory usage in data processing pipelines that produce JSON ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Writes JSON documents in a streaming format without building the entire data structure in memory first, using a context-manager-based interface for arrays and objects. Yes, if you need to write large JSON files or stream JSON output incrementally and want to avoid building the full data structure in memory. The low install friction and permissive license make it a safe choice. However, the dormant maintenance status (last release 2021-03-16) means no active support; use it only for stable, straightforward JSON streaming tasks where you don't expect ongoing development. ## Install pip install jsonstreams uv add jsonstreams poetry add jsonstreams ## Installing jsonstreams Before you install: Low install friction with only two runtime dependencies (six and enum34). Maintenance is dormant—last release was 2021-03-16 and no commits since 2024-05-15—so expect no active bug fixes or feature work, though the package remains stable for its stated use case. License in practice: MIT license (permissive) places no restrictions on use, modification, or distribution in commercial or private projects. Quickstart: import jsonstreams with jsonstreams.Stream(jsonstreams.Type.OBJECT, filename='foo') as s: s.write('foo', 'bar') with s.subobject('a') as a: a.write('foo', 1) a.write('bar', 2) Verify before relying: - Performance characteristics compared to standard json module for typical workloads - Compatibility with Python 3.10+ (classifiers only list up to 3.9) - Whether enum34 dependency is still required on Python 3.4+ ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: dormant - Downloads: 169.6K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags streaming json writer, json output without building tree, memory-efficient json generation, incremental json writing, context manager json, large json file streaming, json, streaming, memory-efficient [View on SkillFed](https://skillfed.io/packages/jsonstreams) · [View on PyPI](https://pypi.org/project/jsonstreams/)