serde-rs / json

Strongly typed JSON library for Rust
Apache License 2.0
4.91k stars 560 forks source link

deserialize from jsons that do not follow conventions(no " or ' instead of ") #1181

Closed frederik-uni closed 3 months ago

frederik-uni commented 3 months ago

Some jsons do not use "" for key & value. Ive seen some jsons that don't use any quotation marks for keys/or only when needed & ' instead of ".

I don't know what the best way for deserializing this would be. maybe something like this.

#[serde_json(key_qm = "'")]
#[serde_json(key_qm = "")]
#[serde_json(value_qm = "'")]

or

serde_json::from_str_opt(s, opt)
dtolnay commented 3 months ago

I would prefer not to support formats other than JSON in this crate.