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 anonymous struct could solve your issue maybe?

On Thursday, December 23, 2021 at 1:23:42 p.m. UTC-5 A JI wrote:

> Why, when the object of struct is lowercase. I can't fill it and convert 
> to JSON ?
>
> https://go.dev/play/p/WZCvC7M5YAp
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/6e6caf08-f69a-4972-8731-0a167e7b2fa9n%40googlegroups.com.

Reply via email to