Marshal of json.RawMessage

后端 未结 2 2114
无人及你
无人及你 2021-02-16 00:21

Please find the code here http://play.golang.org/p/zdQ14ItNBZ

I am keeping JSON data as RawMessage, but cannot decode it out. I need the containing struct to be Marshall

2条回答
  •  余生分开走
    2021-02-16 00:59

    jorellis answer is correct for versions of Go before 1.8.

    Go 1.8 and newer will correctly handle marshalling of both a pointer and non-pointer json.RawMessage.

    Fixing commit: https://github.com/golang/go/commit/1625da24106b610f89ff7a67a11581df95f8e234

提交回复
热议问题