Closed GoogleCodeExporter closed 9 years ago
I specifically designed it to work this way, since I wanted the marshaled json
to be the same whether you are using goprotobuf or gogoprotobuf.
Maybe this is a weak use case.
Maybe you could explain your use case?
I have thought about introducing a gogoprotobuf extension to allow you to
explicitly rename the json tag, would this help your case?
Original comment by awalterschulze
on 25 Jul 2014 at 7:49
The use case we have is that we emit certain events to an analytics pipeline.
These events all share some basic dimensions (timestamp, host, service name,
etc). The analytics pipeline expects a flat json structure and cannot handle
the nested object for the shared dimensions.
An extension to simply skip the json tag would be very nice.
Original comment by unhol...@gmail.com
on 25 Jul 2014 at 8:02
My idea is to make the extension of type string and allow you to replace name
in `json:"name"` with anything you want.
I have not investigated the feasibility of this addition, so this is not going
to happen tomorrow, so I hope that you are ok with implementing a MarshalJSON
method temporarily?
Original comment by awalterschulze
on 25 Jul 2014 at 8:09
Here is my solution
https://groups.google.com/forum/#!topic/gogoprotobuf/xmFnqAS6MIc
The example test showcases your problem with embed.
Here is the commit
https://code.google.com/p/gogoprotobuf/source/detail?r=8bc2f601db62358fff1a06419
ea19d3e0bf80a73
I hope this helps.
Original comment by awalterschulze
on 5 Aug 2014 at 12:03
awesome, thank you!
Original comment by unhol...@gmail.com
on 5 Aug 2014 at 6:12
Original issue reported on code.google.com by
unhol...@gmail.com
on 24 Jul 2014 at 4:31