{"id":16930825,"url":"https://github.com/tmccombs/json-comments-rs","last_synced_at":"2025-08-15T22:09:44.834Z","repository":{"id":34996179,"uuid":"194455989","full_name":"tmccombs/json-comments-rs","owner":"tmccombs","description":"Crate to strip out comments in json for Rust","archived":false,"fork":false,"pushed_at":"2023-11-03T06:07:04.000Z","size":20,"stargazers_count":20,"open_issues_count":4,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-05-02T01:07:57.182Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tmccombs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-29T23:14:56.000Z","updated_at":"2024-06-21T15:35:06.017Z","dependencies_parsed_at":"2024-06-21T15:45:05.647Z","dependency_job_id":null,"html_url":"https://github.com/tmccombs/json-comments-rs","commit_stats":{"total_commits":21,"total_committers":2,"mean_commits":10.5,"dds":0.04761904761904767,"last_synced_commit":"e97d7f521676e78d70637ee7ff3d3a4bfc845a56"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmccombs%2Fjson-comments-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmccombs%2Fjson-comments-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmccombs%2Fjson-comments-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmccombs%2Fjson-comments-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tmccombs","download_url":"https://codeload.github.com/tmccombs/json-comments-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243852438,"owners_count":20358270,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-13T20:42:35.144Z","updated_at":"2025-03-17T07:32:03.747Z","avatar_url":"https://github.com/tmccombs.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# json-comments-rs\n\n[![Build Status](https://github.com/tmccombs/json-comments-rs/actions/workflows/build/badge.svg?branch=main)](https://github.com/tmccombs/json-comments-rs/actions)\n[![Docs](https://docs.rs/json_comments/badge.svg)](https://docs.rs/json_comments/)\n\n`json_comments` is a library to strip out comments from JSON-like text. By processing text\nthrough a [`StripComments`] adapter first, it is possible to use a standard JSON parser (such\nas [serde\\_json](https://crates.io/crates/serde_json) with quasi-json input that contains\ncomments.\n\nIn fact, this code makes few assumptions about the input and could probably be used to strip\ncomments out of other types of code as well, provided that strings use double quotes and\nbackslashes are used for escapes in strings.\n\nThe following types of comments are supported:\n  - C style block comments (`/* ... */`)\n  - C style line comments (`// ...`)\n  - Shell style line comments (`# ...`)\n\n## Example using serde\\_json\n\n```rust\nuse serde_json::{Result, Value};\nuse json_comments::StripComments;\n\nfn main() -\u003e Result\u003c()\u003e {\n// Some JSON input data as a \u0026str. Maybe this comes form the user.\nlet data = r#\"\n    {\n        \"name\": /* full */ \"John Doe\",\n        \"age\": 43,\n        \"phones\": [\n            \"+44 1234567\", // work phone\n            \"+44 2345678\"  // home phone\n        ]\n    }\"#;\n\n// Strip the comments from the input (use `as_bytes()` to get a `Read`).\nlet stripped = StripComments::new(data.as_bytes());\n// Parse the string of data into serde_json::Value.\nlet v: Value = serde_json::from_reader(stripped)?;\n\nprintln!(\"Please call {} at the number {}\", v[\"name\"], v[\"phones\"][0]);\n\nOk(())\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmccombs%2Fjson-comments-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftmccombs%2Fjson-comments-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmccombs%2Fjson-comments-rs/lists"}