Note
it removes
- Comments to end of line
- Single line block comments
- Empty lines
Caution
its NOT covering
- Full spec
- Trailing Commas
- comments in values
- Multi line block comments
:comments-to-endofline
s/\/\/.*$//g
:comment-blocks
s/\/\*.*\*\///g
:empty-lines
/^[[:space:]]*$/d
sed -f basic-jsonc.sed test-file.jsonc
# pipe to jq
sed -f basic-jsonc.sed test-file.jsonc | jq '.'
# replace in place
sed -i -f basic-jsonc.sed test-file.jsonc
sed 's/\/\/.*$//g;s/\/\*.*\*\///g;/^[[:space:]]*$/d' test-file.jsonc | jq