Processes stdout (in JSON format) according to given options. It is supposed to be memory efficient and fast to process.
Consider following context of input.json
file:
```json
{
"users": [
{"name": "user1", "groups": ["admins", "staff"], "password": "secret1"},
{"name": "user2", "groups": ["staff"], "password": "secret2"}
]
}
```
bash
cat input.json | sson extract -m depth:2
Output:
json
{"name": "user1", "authors": ["admins", "staff"], "password": "secret1"}{"name": "user2", "authors": ["staff"], "password": "secret2"}
bash
cat input.json | \
sson extract -m depth:2 | \
sson convert -m 'simple:{"password"}' -h replace:'"***"'
Output:
json
{"name": "user1", "groups": ["admins", "staff"], "password": "***"}{"name": "user2", "groups": ["staff"], "password": "***"}
bash
cat input.json | \
sson extract -m depth:2 | \
sson convert -m 'simple:{"password"}' -h replace:'"***"' | \
sson filter -m 'simple:{"groups"}'
Output:
json
{"name": "user1", "password": "***"}{"name": "user2", "password": "***"}
bash
cat input.json | \
sson extract -m depth:2 | \
sson convert -m 'simple:{"password"}' -h replace:'"***"' | \
sson filter -m 'simple:{"groups"}' | \
sson all -h indenter:2
Output:
json
{
"name": "user1",
"password": "***"
}
{
"name": "user2",
"password": "***"
}
bash
cat input.json | \
sson extract -m depth:2 | \
sson convert -m 'simple:{"password"}' -h replace:'"***"' | \
sson filter -m 'simple:{"groups"}' | \
sson all -h indenter:2 | \
sson trigger -m 'simple:{"name"}' -h file:names.out
Output:
json
{
"name": "user1",
"password": "***"
}
{
"name": "user2",
"password": "***"
}
names.out:
"user1"
"user2"
bash
cat input.json | \
sson extract -m depth:2 | \
sson convert -m 'simple:{"password"}' -h replace:'"***"' | \
sson filter -m 'simple:{"groups"}' | \
sson all -h indenter:2 | \
sson trigger -m 'simple:{"name"}' -h unstringify -h file:names.out
Output:
json
{
"name": "user1",
"password": "***"
}
{
"name": "user2",
"password": "***"
}
names.out:
user1
user2