I am calling an api which returns a Json
.
Its format can change depending upon a member value.
Json
response is dependent on
enum Count {
Single,
Two,
}
Response possible structure.
// When count is Single
{
"error": "false",
"count": "Single",
"fullname": "xyz_abc",
}
// When count is Two
{
"error": "false",
"count": "Two",
"name": "abc",
"address": "Ind",
}
How can i write a struct for this json format?
struct Response {
count: Count,
// Not sure what to add.
}