golang protobuf remove omitempty tag from generated json tags

后端 未结 7 1291
余生分开走
余生分开走 2021-02-04 00:00

I am using google grpc with a json proxy. for some reason i need to remove the omitempty tags from the struct generated in the *.pb.go files.

if i have a pr

相关标签:
7条回答
  • 2021-02-04 00:44

    you can copy the encoding/json package to your own folder for example my_json, and modify omitEmpty field to false, and use my_json.Marshal() to encode the struct to json string.

    0 讨论(0)
提交回复
热议问题