Tools for working with JSON files.
Project description
python-json-tools
Tools for working with json (especially) json-arrays.
Uses ujson
if present, otherwise standard json
.
Usage
Installation
pip install sb-json-tools
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")
json-val (lib: sb_json_tools.jt_val
)
Allows you to validate iterables of json-objects according to json-schema
Regular and async functions.
json-diff (lib: sb_json_tools.jsondiff
)
Allows you to compare two json-objects and get a report how they differ, if they do.
json-val
Command-line tool to validate a json-file with a schema json-schema.
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
Built Distribution
Hashes for sb_json_tools-0.5.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59789aefd6f3eac3f59ca415f0a75b955992441c33a631b40cbfc40aef6b1bb8 |
|
MD5 | 450d55369e210d252f48a4db2fe5eb1d |
|
BLAKE2b-256 | 4d0e90bc54889b4234f43b53a7a6986665a97cf1a82c11ab65ac8e7fcb25a432 |