1# JSON Strip Comments 2 3[![Crates.io][crates-badge]][crates-url] 4[![Docs.rs][docs-badge]][docs-url] 5 6[crates-badge]: https://img.shields.io/crates/d/json-strip-comments?label=crates.io 7[crates-url]: https://crates.io/crates/json-strip-comments 8[docs-badge]: https://img.shields.io/docsrs/json-strip-comments 9[docs-url]: https://docs.rs/json-strip-comments 10 11A fork of a fork for stripping JSON comments and trailing commas in place: 12 13* https://github.com/tmccombs/json-comments-rs 14* https://github.com/parcel-bundler/parcel/pull/9032 15 16## Example 17 18```rust 19use serde_json::Value; 20 21fn main() { 22 let mut data = String::from( 23 r#" 24 { 25 "name": /* full */ "John Doe", 26 "age": 43, 27 "phones": [ 28 "+44 1234567", // work phone 29 "+44 2345678", // home phone 30 ] 31 }"#, 32 ); 33 34 json_strip_comments::strip(&mut data).unwrap(); 35 let value: Value = serde_json::from_str(&data).unwrap(); 36 37 println!("{value}"); 38} 39``` 40