#json #serialization #numbers #macro #obj #string #null

write-json

简单的无依赖、无宏、无特质的JSON序列化

4个版本

0.1.4 2023年12月31日
0.1.2 2020年8月1日
0.1.1 2020年8月1日
0.1.0 2020年8月1日

#192编码

Download history 7473/week @ 2024-04-14 7008/week @ 2024-04-21 6896/week @ 2024-04-28 6182/week @ 2024-05-05 6093/week @ 2024-05-12 7139/week @ 2024-05-19 6717/week @ 2024-05-26 7119/week @ 2024-06-02 7509/week @ 2024-06-09 7117/week @ 2024-06-16 7115/week @ 2024-06-23 6533/week @ 2024-06-30 6591/week @ 2024-07-07 7246/week @ 2024-07-14 6862/week @ 2024-07-21 6669/week @ 2024-07-28

每月下载量 28,447
用于 ungrammar2json

MIT/Apache

8KB
197

write-json

简单的无依赖、无宏、无特质的JSON序列化

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:

简单的无依赖、无宏、无特质的JSON序列化。

示例

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

无运行时依赖