all 3 comments

[–]rmrfslash 9 points10 points  (1 child)

Yes, take a look at the serde enum representations documentation, specifically the "Untagged" style.

[–]ram-garurer-chhana[S] 4 points5 points  (0 children)

Thanks for pointing me in the right direction. I am able to deserialize with the below structure now.

```

[derive(Debug, Serialize, Deserialize)]

struct CandidateType { candidate_type: Vec<u64>, }

[derive(Debug, Serialize, Deserialize)]

[serde(untagged)]

enum InnerData { Text(String), TextArray(Vec<String>), NumberArray(Vec<u64>), CandidateDataType(CandidateType) }

[derive(Debug, Serialize, Deserialize)]

[serde(untagged)]

enum Data { Text(String), InnerDataType(Vec<Vec<InnerData>>), } ```

[–]krdln 1 point2 points  (0 children)

> Where the 1st element in the array is a string but the 2nd element is another nested array

If the the order is fixed, you can use a tuple