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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file jtv-1.74.0.tar.gz.

File metadata

  • Download URL: jtv-1.74.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for jtv-1.74.0.tar.gz
Algorithm Hash digest
SHA256 04e02bc1dcf1fc3207bee124a4794388a8ce76d663405d194965899377b9d017
MD5 b166262b19ddfb733cb02bc5cd6675c7
BLAKE2b-256 d336cc7751095e2f6bda4b014de2c2ec791fe197c6366e226f93612f91d81e04

See more details on using hashes here.

File details

Details for the file jtv-1.74.0-py3-none-any.whl.

File metadata

  • Download URL: jtv-1.74.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for jtv-1.74.0-py3-none-any.whl
Algorithm Hash digest
SHA256 59a65f81cde87601bdb8fbd6ddabe6ac3ec9c4e0d35f80bebebca54936c81b5a
MD5 a35e2d1f3919180874772a89ba1466a4
BLAKE2b-256 ef7a1638c6a545645709d469bfee99905bee10387f34133ecb184482e224fc30

See more details on using hashes here.

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