3 ms·
I found it not very flexible compared to Rust's Serde (https://serde.rs/ https://serde.rs/), which is my only comparison in statically typed languages. Customis
by nicoburns 7y ago
I found it not very flexible compared to Rust's Serde (https://serde.rs/ https://serde.rs/), which is my only comparison in statically typed languages. Customising things like mapping camel case to snake case required creating whole classes.
- Const-me 7y ago> Customising things like mapping camel case to snake case required creating whole classes. The class for that is built-in: https://www.newtonsoft.com/json/help/html/NamingStrategySnakeCase.htm https://www.newtonsoft.com/json/help/html/NamingStrategySnak... The implementation only overrides a single virtual method, ResolvePropertyName https://github.com/JamesNK/Newtonsoft.Json/blob/master/Src/Newtonsoft.Json/Serialization/SnakeCaseNamingStrategy.cs#L82-L85 https://github.com/JamesNK/Newtonsoft.Json/blob/master/Src/N... so if you want some other convention, it’s very easy to create a custom class for that. Looks easy enough to me. I never actually used that part. I prefer to use names from JSON. Or if the JSON schema is really bad, specify JSON names manually with attributes, like this: [JsonProperty( "json_property_09123" )] public string MagicProperty; This way searching source code for a JSON name finds C# class serializing that property. Makes working on the code much easier, IMO.