a simple tool to show all the paths/values in a json/yaml document to help with grep.
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"
cargo install --git 'https://github.com/mathieu-lemay/json-struct'