blob: 8063ae196f6af7fd306272204d5c5311b044bea1 [file] [log] [blame]
// +build ignore
package main
import (
"encoding/json"
"fmt"
"log"
)
func main() {
var data struct {
ID int
Person struct {
Name string
Job string
}
}
const s = `{"ID":42,"Person":{"Name":"George Costanza","Job":"Architect"}}`
err := json.Unmarshal([]byte(s), &data)
if err != nil {
log.Fatal(err)
}
fmt.Println(data.ID, data.Person.Name, data.Person.Job)
}