parsing json data object in golang example

package main

import (
    "encoding/json"
    "fmt"
)

type Person struct {
    Name  string `json:"name"`
    Age   int    `json:"age"`
    City  string `json:"city"`
    Email string `json:"email"`
}

func main() {
    // JSON data as a byte slice
    jsonData := []byte(`{"name": "John Doe", "age": 30, "city": "New York", "email": "[email protected]"}`)

    // Create a variable of type Person to hold the parsed data
    var person Person

    // Unmarshal JSON data into the person variable
    err := json.Unmarshal(jsonData, &person)
    if err != nil {
        fmt.Println("Error:", err)
        return
    }

    // Print the parsed data
    fmt.Println("Name:", person.Name)
    fmt.Println("Age:", person.Age)
    fmt.Println("City:", person.City)
    fmt.Println("Email:", person.Email)
}