Hi A JI,
Here the documentation linked to json.Unmarshal
: https://pkg.go.dev/encoding/json#Marshal
It works only exported fields. Since your field *price* is unexported,
Marshal would just ignore it. You should probably try
this: https://go.dev/play/p/49Zm1fawC9F
Using an intermediate anonym
This is not a real "why", but this how json.Marshal works according to the
documentation. From https://pkg.go.dev/encoding/json#Marshal:
"Struct values encode as JSON objects. Each exported struct field becomes a
member of the object, using the field name as the object key, unless the
field is