My input JSON file is:
{
"name": "abc",
"private": true,
"version": "1.0.0",
"description": "UI",
"dependencies": {
"xyz": "9.11",
"abc": "5.0.0"
}
}
When I use jq .name=xyz, the output will be printed as:
{
"name": "xyz",
"private": true,
"version": "1.0.0",
"description": "UI",
"dependencies": {
"xyz": "9.11",
"abc": "5.0.0"
}
}
Though my input file as proper indentation, after running the jq command the indentation is different.
How can I restrict the indentation?
Thanks in advance!
There is currently no way to instruct jq to preserve the indentation style per se, but the --indent N and --tab command-line options give limited control over the style of indentation. Thus, in the particular case given, one could achieve the desired effect using --indent 4.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With