Skip to main content

Tools for working with JSON files.

Project description

python-json-tools

Build Status codecov Build Status PyPI status

Tools for working with json (especially) json-arrays.

Uses ujson if present, otherwise standard json.

Usage

Installation

pip install sb-json-tools

json-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
in = jt_iter.load_from_file("data.json") # or data.jsonl

# Write to file, again guessing format
jt_iter.dump_to_file("data.jsonl")
from sb_json_tools import json_iter, jsonl_iter

# Open and read the file
in = json_iter.load_from_file("data.json")

# Process file

# Write to file
jsonl_iter.dump_to_file("data.jsonl")

json-val (lib: jt_val)

Allows you to validate iterables of json-objects according to json-schema

Regular and async functions.

json-diff (lib: jt_diff)

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for sb-json-tools, version 0.4.2
Filename, size File type Python version Upload date Hashes
Filename, size sb_json_tools-0.4.2-py3-none-any.whl (10.5 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size sb-json-tools-0.4.2.tar.gz (5.0 MB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page