Jex - JSON/YAML interactive explorer
Why?
-
In a world that JSON/YAML config files take over the world and JQ is not your taste, use the language you already know to explore the data. Whether it is Python/Hylang or ES6 on your favorite web browser developer tool.
-
Fighting the bad practice of using online JSON pretifier/formatter, which is prone to leak credentials contained in JSON/YAML (e.g K8S secret output).
Install
pip install jex
Features
- Supports input JSON/YAML.
Explorers
Supports exploring via
- Python interpreter
- Hylang interpreter
hy - Interactive Ruby Shell
irb - Node
node - Web browser
Usage
- Just pipe the jex after the command that outputs JSON/YAML.
$ curl -ssL https://api.github.com/users/hvnsweeting/repos | jex
- Use
jex -wto open data on your browser, open web console and access the data viadata.
-
Use
jex -ito open simple python interpreter - in same process - useful on no GUI environment. -
Use
jexwould open a new window for interactive exploring the data via namedatain Python interactive interpreter: This pre-importpprint, all functions initertools,functools,operatorstdlib. Provide--repl LANGto invoke other language interpreters.
========== WELCOME TO JEX ==========
Access the data via name data
data is a list, with length 30, first elem of type <class 'dict'>
>>> data[0].keys()
dict_keys(['id', 'node_id', 'name', 'full_name', 'private', 'owner', 'html_url', 'description', 'fork', 'url', 'forks_url', 'keys_url', 'collaborators_url', 'teams_url', 'hooks_url', 'issue_events_url', 'events_url', 'assignees_url', 'branches_url', 'tags_url', 'blobs_url', 'git_tags_url', 'git_refs_url', 'trees_url', 'statuses_url', 'languages_url', 'stargazers_url', 'contributors_url', 'subscribers_url', 'subscription_url', 'commits_url', 'git_commits_url', 'comments_url', 'issue_comment_url', 'contents_url', 'compare_url', 'merges_url', 'archive_url', 'downloads_url', 'issues_url', 'pulls_url', 'milestones_url', 'notifications_url', 'labels_url', 'releases_url', 'deployments_url', 'created_at', 'updated_at', 'pushed_at', 'git_url', 'ssh_url', 'clone_url', 'svn_url', 'homepage', 'size', 'stargazers_count', 'watchers_count', 'language', 'has_issues', 'has_projects', 'has_downloads', 'has_wiki', 'has_pages', 'forks_count', 'mirror_url', 'archived', 'disabled', 'open_issues_count', 'license', 'forks', 'open_issues', 'watchers', 'default_branch'])
>>> pprint([(i['name'], i['html_url']) for i in data])
[('adventofcode', 'https://github.com/hvnsweeting/adventofcode'),
('airflow_docker', 'https://github.com/hvnsweeting/airflow_docker'),
('albatross', 'https://github.com/hvnsweeting/albatross'),
('alloy_ci', 'https://github.com/hvnsweeting/alloy_ci'),
('amnesia', 'https://github.com/hvnsweeting/amnesia'),
...
$ echo 'apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80' | jex
========== WELCOME TO JEX ==========
Access the data via name data
data is a dict, with keys: ['apiVersion', 'kind', 'metadata', 'spec']
>>> pprint(data['spec'])
{'replicas': 3,
'selector': {'matchLabels': {'app': 'nginx'}},
'template': {'metadata': {'labels': {'app': 'nginx'}},
'spec': {'containers': [{'image': 'nginx:1.14.2',
'name': 'nginx',
'ports': [{'containerPort': 80}]}]}}}
TODO
- Support Jid.
Authors
- Viet Hung Nguyen hvn@familug.org
Metadata
Release files for jex 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jex-0.1.6.tar.gz | 5.9 kB | Without provenance | Details for jex-0.1.6.tar.gz |
Release files / jex-0.1.6.tar.gz
| Download URL | jex-0.1.6.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
61a1deacf9572daf5af37b93bee813ed7a28b645b5e16461d8149e32966e92bf
|
|
BLAKE2b-256 checksum How to use checksums |
a2870bbdd107b961730ae88358550e1b2e9856672608ab5a6c23e021f0ba4c5d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10
|
Security for jex 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.