#nanoserde #default #tree #nanoserde-derive #ser-json

macro nanoserde-derive

Fork of makepad-tinyserde derive without any external dependencies

25 releases

0.2.1 Mar 22, 2025
0.2.0-beta.0 Jul 28, 2024
0.1.22 Jan 25, 2024
0.1.21 Sep 1, 2023
0.1.12 Jul 20, 2020

#499 in #default

Download history 2139/week @ 2024-12-20 3005/week @ 2024-12-27 3177/week @ 2025-01-03 6286/week @ 2025-01-10 5044/week @ 2025-01-17 5199/week @ 2025-01-24 5416/week @ 2025-01-31 6522/week @ 2025-02-07 5675/week @ 2025-02-14 7381/week @ 2025-02-21 5514/week @ 2025-02-28 8115/week @ 2025-03-07 10359/week @ 2025-03-14 10405/week @ 2025-03-21 12491/week @ 2025-03-28 15566/week @ 2025-04-04

50,308 downloads per month
Used in 52 crates (via nanoserde)

MIT license

110KB
3K SLoC

nanoserde

Github Actions Crates.io version Documentation Discord chat

Fork of https://crates.io/crates/makepad-tinyserde with all the dependencies removed. No more syn, proc_macro2 or quote in the build tree!

> cargo tree
nanoserde v0.2.0 (/../nanoserde)
└── nanoserde-derive v0.2.0 (/../nanoserde/derive)

Example:

use nanoserde::{DeJson, SerJson};

#[derive(Clone, Debug, Default, DeJson, SerJson)]
pub struct Property {
    pub name: String,
    #[nserde(default)]
    pub value: String,
    #[nserde(rename = "type")]
    pub ty: String,
}

For more examples take a look at tests

Features support matrix:

Feature json bin ron toml
serialization yes yes yes no
deserialization yes yes yes no
container: Struct yes yes yes no
container: Tuple Struct no yes yes no
container: Enum yes yes yes no
field: std::collections::HashMap yes yes yes no
field: std::vec::Vec yes yes yes no
field: Option yes yes yes no
field: i*/f*/String/T: De*/Ser* yes yes yes no
field attribute: #[nserde(default)] yes no yes no
field attribute: #[nserde(rename = "")] yes yes yes no
field attribute: #[nserde(proxy = "")] no yes no no
field attribute: #[nserde(serialize_none_as_null)] yes no no no
container attribute: #[nserde(default)] yes no yes no
container attribute: #[nserde(default = "")] yes no yes no
container attribute: #[nserde(default_with = "")] yes no yes no
container attribute: #[nserde(skip)] (implies default) yes no yes no
container attribute: #[nserde(serialize_none_as_null)] yes no no no
container attribute: #[nserde(rename = "")] yes yes yes no
container attribute: #[nserde(proxy = "")] yes yes no no
container attribute: #[nserde(transparent)] yes no no no
container attribute: #[nserde(crate = "")] yes yes yes no

Crate features:

All features are enabled by default. To enable only specific formats, import nanoserde using

nanoserde = { version = "*", default-features = false, features = ["std", "{format feature name}"] }

in your Cargo.toml and add one or more of the following crate features:

Format Feature Name
Binary binary
JSON json
RON ron
TOML toml

No runtime deps

Features