rust - serde_json - how to make my struct convertable from / to json? -
looking @ the documentation of serde_json, can't understand trait have implement make struct serializiable , deserializiable json. obvious answer deserializer
, serializer
these structs, not traits.
with rustc-serialize
implement tojson
, fromjson
traits.
from crate index page:
serde provides mechanism low boilerplate serialization & deserialization of values , json via serialization api. able serialize piece of data, must implement
serde::serialize
trait. able deserialize piece of data, must implementserde::deserialize
trait. serde provides provides annotation automatically generate code these traits:#[derive(serialize, deserialize)]
.
Comments
Post a Comment