Avatar ·

Unpacking nested JSON objects in Go: problem with empty fields

Hello everyone!\n\nI'm new to Go and trying to parse JSON with nested objects, but I'm not getting it right. The JSON comes from an external API and looks something like this:\n\n```json\n{\n "id": 123,\n "name": "Test",\n "details": {\n "age": 30,\n "city": "Moscow"\n }\n}\n```\n\nI created the structures:\n\n```go\ntype Person struct {\n ID int `json:"id"`\n Name string `json:"name"`\n Details Details `json:"details"`\n}\n\ntype Details struct {\n Age int `json:"age"`\n City string `json:"city"`\n}\n```\n\nAnd trying to parse:\n\n```go\nvar person Person\nerr := json.Unmarshal([]byte(jsonString), &person)\nif err != nil {\n log.Fatal(err)\n}\nfmt.Println(person)\n```\n\nThe problem is that when I run the code, the `Age` and `City` fields inside `Details` are always