I am trying to deserialize JSON which looks like this:
{
"pattern": {"@odata.type": "microsoft.graph.recurrencePattern"},
"range": {"@odata.type": "microsoft.graph.recurrenceRange"}
}
For this I created several structs where the first one looks like this:
type MSPatternedRecurrence struct {
Pattern MSRecurrencePattern `json:"@odata.type"`
Range MSRecurrenceRange `json:"@odata.type"`
}
However go vet throws an error like this:
struct field Range repeats json tag "@odata.type"
What is the right way to create a struct in this situation?
type MSPatternedRecurrence struct {
Pattern MSRecurrencePattern json:"@odata.type"
Range MSRecurrenceRange json:"@odata.type"
}
type MSRecurrencePattern struct {
DayOfMonth int `json:"dayOfMonth"`
DayOfWeek []string `json:"daysOfWeek"`
FirstDayOfWeek string `json:"firstDayOfWeek"`
Index string `json:"index"`
Interval int `json:"interval"`
Month int `json:"month"`
Type string `json:"type"`
}
type MSRecurrenceRange struct {
EndDate string `json:"endDate"`
NumberOfOccurrences int `json:"numberOfOccurrences"`
RecurrenceTimeZone string `json:"recurrenceTimeZone"`
StartDate string `json:"startDate"`
Type string `json:"type"`
}