Re: [go-nuts] json.Marshal

2018-11-01 Thread robert engels
Capital Letters = export > On Nov 1, 2018, at 9:22 AM, Alex Dvoretskiy wrote: > > No, no need to export, unless fields have weird names. Fields must be with > capital letters: > > https://play.golang.org/p/zMeKqW-4JT9 > > On Wednesday, October 31, 2018 at 11:12:05 PM UTC-7, kortschak wrote: >

Re: [go-nuts] json.Marshal

2018-11-01 Thread Alex Dvoretskiy
No, no need to export, unless fields have weird names. Fields must be with capital letters: https://play.golang.org/p/zMeKqW-4JT9 On Wednesday, October 31, 2018 at 11:12:05 PM UTC-7, kortschak wrote: > > https://play.golang.org/p/Se8wXfYZVZG > > You need to export the field: > ``` > Struct va

Re: [go-nuts] json.Marshal

2018-10-31 Thread Dan Kortschak
https://play.golang.org/p/Se8wXfYZVZG You need to export the field: ``` 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 omitted for one of the reasons given below. ``` On Wed, 2018-10-31 a

Re: [go-nuts] json.Marshal... what am I doing wrong here?

2017-01-07 Thread Shawn Milochik
You have to export any fields to marshal, or other packages (including encoding/json) can't see them. https://play.golang.org/p/W5R4oH0oUR On Jan 8, 2017 01:30, "Eric Brown" wrote: > Simple example... what am I doing wrong? > > https://play.golang.org/p/WR9yehNF5_ > > -- > You received this mes