Is there some kind of serde tag path?

I want to parse a following JSON

[
    {
        "info": {
          "type": "X"
        },
        "a": 10,
        "b": 20
    },
    {
        "info": {
          "type": "Y"
        },
        "c": "Hello"
    }
]

The problem is I'm not sure how to do so. What do I want is something like:

#[derive(Serialize, Deserialize)]
#[serde(tag = "info.type")]
enum Message {
    X { info: Info, a: i32, b: i32 },
    Y { info: Info, c: String },
}

But I didn't find any way to represent it in serde. What can I do to make it search for a tag in provided path?..

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.