Crates.io | write-json |
lib.rs | write-json |
version | 0.1.4 |
source | src |
created_at | 2020-08-01 02:09:14.298529 |
updated_at | 2023-12-31 11:29:35.513211 |
description | Simple {dependency,trait,macro}-less JSON serialization |
homepage | |
repository | https://github.com/matklad/write-json |
max_upload_size | |
id | 271825 |
size | 20,427 |
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}"#
)