m json¶
Format a json payload.
similar to python -m json.tool
but instead it uses 2 spaces
for indentation::
$ echo '{"a":99}' | m json
{
"a": 99
}
It is worth noting that if you have access to jq
or yq
then
it should be used instead of m json
::
$ echo '{"a":99}' | jq
{
"a": 99
}
- jq: https://stedolan.github.io/jq/manual/
- yq: https://mikefarah.gitbook.io/yq/
Source code in m/cli/commands/json.py
Options¶
--sort-keys
¶
- default:
false
sort the output of dictionaries alphabetically by key
Positional arguments¶
payload
¶
- default:
'@-'
json data: @- (stdin), @filename (file), string