package main
import (
"fmt"
"github.com/goccy/go-json"
)
type Base struct {
B string `json:"bb"`
}
type Test struct {
Base
A string `json:"aA"`
}
func main() {
b := &Test{}
err := json.Unmarshal([]byte(`{"Aa":"111","Bb":"222"}`), b)
fmt.Printf("b: %v, err: %v\n", b, err)
}
example:
prints:
change
json:"bB"
tojson:"bb"
then it works:tested with go 1.14.5 and go-json master