Package: jex
Jex - JSON/YAML interactive explorerWhy?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).Installpip install jexFeaturesSupports input JSON/YAML.ExplorersSupports exploring viaPython interpreterHylang interpreterhyInteractive Ruby ShellirbNodenodeWeb browserUsageJust pipe the jex after the command that outputs JSON/YAML.$ curl -ssL https://api.github.com/users/hvnsweeting/repos | jexUsejex -wto open data on your browser, open web console and access the data viadata.Usejex -ito open simple python interpreter - in same process - useful on
no GUI environment.Usejexwould 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.==========WELCOMETOJEX==========Accessthedatavianamedatadataisalist,withlength30,firstelemoftype<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'])foriindata])[('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/v1kind:Deploymentmetadata:name:nginx-deploymentlabels:app:nginxspec:replicas:3selector:matchLabels:app:nginxtemplate:metadata:labels:app:nginxspec:containers:-name:nginximage:nginx:1.14.2ports:-containerPort:80' | jex==========WELCOMETOJEX==========Accessthedatavianamedatadataisadict,withkeys:['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}]}]}}}TODOSupport Jid.AuthorsViet Hung Nguyenhvn@familug.org