obmarg/serde_eetf

Serializing structs with the keys being Binary Strings instead of Atoms

Closed this issue · 1 comments

I need to serialize a struct and have the Erlang Map keys be Binary Strings (<<"key">>) instead of Atoms (key). how can I do that?

Hi @MaiTheLord. You can probably do this by implementing Serialize yourself and using serialize_map for your struct instead of serialize_struct. serialize_struct is always going to use atoms for the keys.

Either that or you could fork this crate and change this line to use a string instead of an atom.