Я пытаюсь десериализовать JSON, который выглядит как this :
{
"pattern": {"@odata.type": "microsoft.graph.recurrencePattern"},
"range": {"@odata.type": "microsoft.graph.recurrenceRange"}
}
Для этого я создал несколько структур, первая из которых выглядит так:
type MSPatternedRecurrence struct {
Pattern MSRecurrencePattern `json:"@odata.type"`
Range MSRecurrenceRange `json:"@odata.type"`
}
Однако, ветеринар выдает ошибку вроде этого:
struct field Range repeats json tag "@odata.type"
Как правильно создать структуру в этой ситуации?
тип MSPatternedRecurrence struct {
Шаблон MSRecurrencePattern json:"@odata.type"
Диапазон 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"`
}