Skip to main content

Command line utility for visualising JSON and YAML schemas as text trees

Project description

jtv

jtv is a command line utility which allows you to visualise JSON and YAML schemas as text trees. It may be used as a complement to jq, to facilitate the interpretation of a JSON schema, prior to defining filters.

Installation

$ pip install --upgrade pip
$ pip install jtv

Usage

To show the help use jtv -h

new_help

Inconsistency handling

Arrays may contain objects with different schemas. By default, or using the option --mode distinct will wrap all objects in a new object with the node key specifying a schema version. The appended ◎-schema-0 node does not exist in the JSON and is strictly used to differentiate between different object schemas.

$ echo '[{"0": {"00": [{"000": "", "001": true, "002": []}, {"NEW": {"A": 2}}]}, "1": {"10": []}}, {"A": {"r": []}}]' | jtv -j --mode distinct

new_distinct

To display all the nodes from each distinct object under a single object, use --mode union.

$ echo '[{"0": {"00": [{"000": "", "001": true, "002": []}, {"NEW": {"A": 2}}]}, "1": {"10": []}}, {"A": {"r": []}}]' | jtv -j --mode union

new_union

To display only the schema of the first object use --mode first.

$ echo '[{"0": {"00": [{"000": "", "001": true, "002": []}, {"NEW": {"A": 2}}]}, "1": {"10": []}}, {"A": {"r": []}}]' | jtv -j --mode first

new_first

To visualise JSON schemas, as above, use the -j flag. To visualise YAML schema use the -y flag.

$ cat .yml | jtv -y

new_yaml

Tests

Run tox in the root project directory.

Development

Increment version:

bumpver update --minor

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

jtv-1.74.0.tar.gz (9.5 kB view hashes)

Uploaded Source

Built Distribution

jtv-1.74.0-py3-none-any.whl (8.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page