package main
import (
"fmt"
"encoding/json"
)
type Base struct {
A int `json:"a"`
}
type Container struct {
Base
B int `json:"b"`
}
func main() {
data := []byte("{\"a\":10,\"b\":20}")
var c Container
if err := json.Unmarshal(data, &c); err != nil {
panic(err)
}
fmt.Println(c)
}
To embed this program on your website, copy the following code and paste it into your website's HTML: