#json #serialization

write-json

Simple {dependency,trait,macro}-less JSON serialization

3 releases

0.1.2 Aug 1, 2020
0.1.1 Aug 1, 2020
0.1.0 Aug 1, 2020

#700 in Encoding

Download history 8284/week @ 2023-05-26 7831/week @ 2023-06-02 7144/week @ 2023-06-09 7516/week @ 2023-06-16 7410/week @ 2023-06-23 7180/week @ 2023-06-30 6445/week @ 2023-07-07 6666/week @ 2023-07-14 6510/week @ 2023-07-21 6931/week @ 2023-07-28 6384/week @ 2023-08-04 4946/week @ 2023-08-11 5008/week @ 2023-08-18 5198/week @ 2023-08-25 5351/week @ 2023-09-01 5005/week @ 2023-09-08

21,289 downloads per month
Used in ungrammar2json

MIT/Apache

8KB
193 lines

write-json

Simple {dependency,trait,macro}-less JSON serialization

let mut buf = String::new();

{
    let mut obj = write_json::object(&mut buf);
    obj.string("name", "Peter").number("favorite number", 92.0);
    obj.array("films")
        .string("Drowning By Numbers")
        .string("A Zed & Two Noughts");
    obj.null("suitcase");
}

assert_eq!(
    buf,
    r#"{"name":"Peter","favorite number":92,"films":["Drowning By Numbers","A Zed & Two Noughts"],"suitcase":null}"#
)

lib.rs:

Simple dependency-less macro-less trait-less JSON serialization.

Example

let mut buf = String::new();

{
    let mut obj = write_json::object(&mut buf);
    obj.string("name", "Peter").number("favorite number", 92.0);
    obj.array("films")
        .string("Drowning By Numbers")
        .string("A Zed & Two Noughts");
    obj.null("suitcase");
}

assert_eq!(
    buf,
    r#"{"name":"Peter","favorite number":92,"films":["Drowning By Numbers","A Zed & Two Noughts"],"suitcase":null}"#
)

No runtime deps