7.19. cape-expandjson
: Expand a JSON file and remove comments¶
This function performs two tasks:
Removes comments starting with either
"//"
or"#"
Replaces
JSONFile(fname)
with the contents of fname
The comments are removed recursively, so comments within children files
are allowed. If the output file is the same as the input file, the
suffix .old
is added to the original file, and the expanded contents
are written to a new file with the same name as the input file.
The default output file OFILE puts the infix “expanded” before the
.json
of the input file. So for example
myfile.json
->myfile.expanded.json
- Usage:
$ cape-expandjson IFILE OFILE [OPTIONS] $ cape-expandjson -i IFILE [-o OFILE] [OPTIONS]
- Inputs:
IFILE: name of input file
OFILE: output file for IFILE
- OPTIONS:
- -h, --help
Display this help message and exit
- -i IFILE
Use IFILE as input file
- -o OFILE
Use OFILE as output file
- Versions:
2015-10-27
@ddalle
: Version 1.0:ExpandJSON()
2021-10-12
@ddalle
: Version 2.0; move tocli