Last active
March 28, 2025 09:04
-
-
Save ThomasVille/54a9a8a89098385d451eea443b82dd9e to your computer and use it in GitHub Desktop.
Remove comments from JSON file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This sed command removes every C-style single line comments (//) from a file that can contain strings delimited by `"` | |
| # (intended for use with JSON files). | |
| # So this JSON: | |
| # { | |
| # "app url": "https://www.example.com" // URL of the application | |
| # } | |
| # becomes: | |
| # { | |
| # "app url": "https://www.example.com" | |
| # } | |
| sed -re 's#^(([^"\n]*"[^"\n]*")*[^"\n]*)\/\/.*$#\1#' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment