{"id":21678465,"url":"https://github.com/jc21/json-strip-comments","last_synced_at":"2026-05-13T07:38:18.652Z","repository":{"id":61626776,"uuid":"485628513","full_name":"jc21/json-strip-comments","owner":"jc21","description":"A command to strip c style comments from a given file","archived":false,"fork":false,"pushed_at":"2023-01-09T05:17:55.000Z","size":9,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-20T09:50:52.459Z","etag":null,"topics":["golang","json","jsonc"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jc21.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-26T04:07:11.000Z","updated_at":"2023-08-13T20:46:18.000Z","dependencies_parsed_at":"2023-02-08T09:00:19.610Z","dependency_job_id":null,"html_url":"https://github.com/jc21/json-strip-comments","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jc21/json-strip-comments","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jc21%2Fjson-strip-comments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jc21%2Fjson-strip-comments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jc21%2Fjson-strip-comments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jc21%2Fjson-strip-comments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jc21","download_url":"https://codeload.github.com/jc21/json-strip-comments/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jc21%2Fjson-strip-comments/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32973311,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T06:31:55.726Z","status":"ssl_error","status_checked_at":"2026-05-13T06:31:51.336Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","json","jsonc"],"created_at":"2024-11-25T14:35:04.074Z","updated_at":"2026-05-13T07:38:18.634Z","avatar_url":"https://github.com/jc21.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSON Strip Comments\n\nThis is a very simple command that will remove comments from JSON files.\n\n_Strictly speaking this could be used on any text file not just JSON, however\nthe project's goal and logic is centered around JSON files._\n\n```bash\nRemoves c style comments from a json file\nUsage: json-strip-comments [--output OUTPUT] [--empty] [FILENAME]\n\nPositional arguments:\n  FILENAME\n\nOptions:\n  --output OUTPUT, -o OUTPUT\n                         Output to given filename instead of stdout\n  --empty, -e            Remove empty lines after comment removals\n  --help, -h             display this help and exit\n```\n\n## Caveats\n\nDue to the simplicity of this project, only comments with whitespace preceeding them\nwill be removed. This prevents removing false positive comments from the inside of a\njson string for example.\n\n```jsonc\n// this comment will be removed\n{\n  // and this one too\n  \"id\": 1,\n  /* and so will this */\n  \"name\": \"Bobby Tables\",\n  /*\n  Multi line comments are removed as well \\o/\n  */\n  \"email\": \"user@example.com\", // however, this comment will NOT be removed\n  \"enabled\": true /* and neither would this one */\n}\n```\n\n## Usage Examples\n\n#### Piping stdin\n\n```bash\ncat somefile.jsonc | json-strip-comments\n```\n\n#### Removing empty lines\n\n```bash\ncat somefile.jsonc | json-strip-comments -e\n```\n\n#### Specify an input file\n\n```bash\njson-strip-comments -e something.jsonc\n```\n\n#### Specify an output file\n\n```bash\ncat input.jsonc | json-strip-comments -e -o \"output.json\"\n# or\njson-strip-comments -e -o \"output.json\" \"input.jsonc\"\n```\n\n#### Using wildcards in output filename\n\nThis only workls when using the incoming filename\n\n```bash\njson-strip-comments -e -o \"[folder][file].json\" \"/path/to/input.jsonc\"\n# writes to: /path/to/input.json\n```\n\n#### Perform on all files in current folder\n\nThis involves a bit of bash magic, it looks for all `.jsonc` files\nand writes `.json` files with the same name in the same place.\n\n```bash\nfind ./ -type f -name \"*.jsonc\" -exec json-strip-comments -e -o \"[folder][file].json\" \"{}\" \\;\n```\n\n\n## Install\n\n#### Centos\n\nRPM hosted on [yum.jc21.com](https://yum.jc21.com)\n\n#### Go Install\n\n```bash\ngo install github.com/jc21/json-strip-comments@latest\n```\n\n\n#### Building\n\n```bash\ngit clone https://github.com/jc21/json-strip-comments \u0026\u0026 cd json-strip-comments\ngo build -o bin/json-strip-comments cmd/json-strip-comments/main.go\n./bin/json-strip-comments -h\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjc21%2Fjson-strip-comments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjc21%2Fjson-strip-comments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjc21%2Fjson-strip-comments/lists"}