Stream objects from json-arrays or json lines lazily..
Project description
json-streams
Tools for working with json (especially) json-arrays.
Uses ujson
if present, otherwise standard json
.
Usage
Installation
pip install json-streams
json-iter (lib: sb_json_tools.jt_iter
)
Allows you to use json.load
and json.dump
with
both json and json-lines files as well as dumping generators.
from sb_json_tools import jt_iter
# This command tries to guess format and opens the file
data = jt_iter.load_from_file("data.json") # or data.jsonl
# Write to file, again guessing format
jt_iter.dump_to_file(data, "data.jsonl")
from sb_json_tools import json_iter, jsonl_iter
# Open and read the file
data = json_iter.load_from_file("data.json")
# Process file
# Write to file
jsonl_iter.dump_to_file(data, "data.jsonl")
Development
After cloning the repo, just run
$ make test
to setup a virtual environment, install dev dependencies and run the unit tests.
Note: If you run the command in a activated virtual environment, that environment is used instead.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
json-streams-0.2.1.tar.gz
(8.1 MB
view hashes)
Built Distribution
Close
Hashes for json_streams-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f91b2493110cde6eba103ed65f59f274881180017707676380f5f3d7b86d50eb |
|
MD5 | 7063daf9b6182df30f4f933a4d15381f |
|
BLAKE2b-256 | 3f15de27ea516faad31e23706ad183078919f46539fcad082fe3356faedb3995 |