I'm doing a call to Google Translate API and would like to represent the response as a struct. The JSON response is:
{
"data": {
"translations": [
{
"translatedText": "Mi nombre es John, nació en Nairobi y tengo 31 años de edad",
"detectedSourceLanguage": "en"
}
]
}
}
I've tried to come up with a struct:
type Translations struct{
TranslatedText string
SourceLanguage string
}
type Translation struct{
Data string
Value *[]Translations
}
or:
type Translations struct{
TranslatedText string
SourceLanguage string
}
type Translation struct{
Data string
Value Translations
}
Which is the correct way to do it?