I have this code:
let vid = VideoLayer::VideoConcatLayer(VideoConcatLayer {
list: vec![VideoLayer::VideoAssetLayer(VideoAssetLayer {
asset: T3Val::Ready(
Ready {
val: "hello".to_string()
})
})]
});
Basically VideoLayer and T3Val are enums and VideoConcatLayer, VideoAssetLayer, and Ready are structs. The problem is that when I try to serialize it with serde, the "type" field is duplicated and it throws an error.
The serialized result is here:
{"type":"VideoConcatLayer","type":"VideoConcatLayer","list":[{"type":"VideoAssetLayer","type":"VideoAssetLayer","asset":{"type":"Ready","type":"Ready","val":"hello"}}]}