tree: d83c73a885fa47fdeef4b08821d50a472d251b9f [path history] [tgz]
  1. benches/
  2. examples/
  3. src/
  4. .android-checksum.json
  5. .cargo-checksum.json
  6. Android.bp
  7. Cargo.lock
  8. Cargo.toml
  9. cargo_embargo.json
  10. LICENSE
  11. METADATA
  12. MODULE_LICENSE_MIT
  13. README.md
  14. rust-toolchain.toml
crates/json-strip-comments/README.md

JSON Strip Comments

Crates.io Docs.rs

A fork of a fork for stripping JSON comments and trailing commas in place:

Example

use serde_json::Value;

fn main() {
    let mut data = String::from(
        r#"
     {
         "name": /* full */ "John Doe",
         "age": 43,
         "phones": [
             "+44 1234567", // work phone
             "+44 2345678", // home phone
         ]
     }"#,
    );

    json_strip_comments::strip(&mut data).unwrap();
    let value: Value = serde_json::from_str(&data).unwrap();

    println!("{value}");
}