Golang encoding/json.RawMessage.MarshalJSON function example

package encoding/json

MarshalJSON returns *m as the JSON encoding of m.

Golang encoding/json.RawMessage.MarshalJSON function usage example

 var t TweetMessageType

 bytes, err := json.RawMessage.MarshalJSON()
 if err != nil {
 fmt.Printf("error calling marshalJson:%v", err)
 }

 json.Unmarshal(bytes, t)

Reference :

http://golang.org/pkg/encoding/json/#RawMessage.MarshalJSON

Advertisement