Entries from 2018-06-23 to 1 day

interface要素を持つstructへのJSON Unmarshal

Go

ちょっとやり方が分からなくて調べたのでメモ。 例題 type hoge struct { Foo int `json:"foo"` Bar baz `json:"bar"` } type baz interface { hoge() } type fuga struct { Fuga string `json:"fuga"` } func (*fuga) hoge() {} という感じで "foo" は int …