yes. because when I marshal it to json the number got messed up.
when I entered value 10.0 it became 10.
If I use json.number it keeps the format 10.0.

Regards.


On Mon, Nov 2, 2020 at 2:46 PM Brian Candler <[email protected]> wrote:

> Is there a particular reason why you don't just do this?
>
> type Product struct {
>     Weight float64
> }
>
> That should serialize to/from JSON just fine.  You can also include
> metadata about how you want it serialized:
>
> type Product struct {
>     Weight float64 `json:"weight,omitempty"`
> }
>
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/07b5217b-2b7e-47e0-8316-fba13d869cado%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/07b5217b-2b7e-47e0-8316-fba13d869cado%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAEKPugjgkCrsZ8yq-_cTcux3Ls2VUo_NANn1F45-oH826uuu9A%40mail.gmail.com.

Reply via email to