json-strip-comments

Crates.iojson-strip-comments
lib.rsjson-strip-comments
version1.0.4
sourcesrc
created_at2024-01-19 08:11:31.033241
updated_at2024-07-21 00:35:39.064235
descriptionStrip comments from JSON
homepage
repositoryhttps://github.com/oxc-project/json-strip-comments
max_upload_size
id1105060
size43,924
Boshen (Boshen)

documentation

README

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}");
}
Commit count: 0

cargo fmt