package main

import (
	"encoding/json"
	"fmt"
	"log"
)

func main() {
	// section: main
	// Anonymous structs are great for one-off JSON parsing
	data := []byte(`{"name": "Alice", "age": 30}`)

	var person struct {
		Name string `json:"name"`
		Age  int    `json:"age"`
	}

	if err := json.Unmarshal(data, &person); err != nil {
		log.Fatal(err)
	}

	fmt.Printf("Name: %s, Age: %d\n", person.Name, person.Age)
	// section: main
}

/*
// section: output
$ go run main.go
Name: Alice, Age: 30
// section: output
*/
