yaml-set usage on JSON removes identation
deepakbshetty opened this issue · 1 comments
Is your feature request related to a problem? Please describe.
Problem - yaml-set removes indentation on large JSON files
yaml-set 3.7.0
test.json
{
"people": {
"name": "john",
"age": 30,
"state": {"name": "up"}
}
}
yaml-set --mustexist --change=people.name --value="John Doe" test.json
{"people": {"name": "John Doe", "age": 30, "state": {"name": "up"}}}
Describe the solution you'd like
yaml-set to retain JSON indent while performing operation.
Should be one-line change to add indent
https://github.com/wwkimball/yamlpath/blob/master/yamlpath/commands/yaml_set.py#L301
json.dump(Parsers.jsonify_yaml_data(yaml_data), out_fhnd, indent=4)
Describe alternatives you've considered
pprintjson python package can be used, but needs tmp copy and can not perform an in-place replace.
This new feature has been added. Please refer to the new --json-indent
/-J
option that is now available to both yaml-set and yaml-merge as of release version 3.8.0. Thanks!!