Skip to content

Rust crate for stripping JSON comments and trailing commas

License

Notifications You must be signed in to change notification settings

oxc-project/json-strip-comments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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}");
}

About

Rust crate for stripping JSON comments and trailing commas

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Languages