Skip to content

A simple tool to show all the paths/values in a json/yaml document to help with grep

Notifications You must be signed in to change notification settings

mathieu-lemay/json-struct

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSON Struct

a simple tool to show all the paths/values in a json/yaml document to help with grep.

Usage

Show struct of a json file:

$ cat > file.json << EOF
{
  "name": "John Doe",
  "age": 43,
  "address": {
    "street": "10 Downing Street",
    "city": "London"
  },
  "phones": [
    "+44 1234567",
    "+44 2345678"
  ]
}
EOF

$ json-struct file.json
.address.city => "London"
.address.street => "10 Downing Street"
.age => 43
.name => "John Doe"
.phones[0] => "+44 1234567"
.phones[1] => "+44 2345678"

Read json from stdin:

$ echo '{"foo": "bar"}' | json-struct
.foo => "bar"

Show struct of a yaml file:

$ cat > file.yaml << EOF
name: John Doe
age: 43
address:
  street: 10 Downing Street
  city: London
phones:
  - +44 1234567
  - +44 2345678
EOF

$ json-struct file.yaml
.address.city => "London"
.address.street => "10 Downing Street"
.age => 43
.name => "John Doe"
.phones[0] => "+44 1234567"
.phones[1] => "+44 2345678"

Read yaml from stdin:

$ echo 'foo: bar' | json-struct --type yaml
.foo => "bar"

Install

Install directly from github

cargo install --git 'https://github.com/mathieu-lemay/json-struct'

About

A simple tool to show all the paths/values in a json/yaml document to help with grep

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages