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

[go-nuts] json.Marshal

2018-10-31 Thread Alex Dvoretskiy
11:07 PM (less than a minute ago) How can I get this json in output? [ { "s": 123, "id": "adsfasdf" }, { "s": 123, "id": "sefascss" } ] https://play.golang.org/p/cQNIKuGXRmj -- You received this message because you are subscribed to the

[go-nuts] json.Marshal

2018-10-31 Thread Alex Dvoretskiy
How can I get this json in output? [ { "s": 123, "id": "adsfasdf" }, { "s": 123, "id": "sefascss" } ] https://play.golang.org/p/AHcUO5IuByf -- You received this message because you are subscribed to the Google Groups "golang-nuts" group.

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

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

2017-01-07 Thread Eric Brown
Simple example... what am I doing wrong? https://play.golang.org/p/WR9yehNF5_ -- 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...@googlegroup