Skip to content

Instantly share code, notes, and snippets.

@wozz
Created March 15, 2016 02:51
Show Gist options
  • Save wozz/fa287d864d44e771e204 to your computer and use it in GitHub Desktop.
Save wozz/fa287d864d44e771e204 to your computer and use it in GitHub Desktop.
import (
"encoding/json"
"strings"
)
type S struct {
Id int `json:"id"`
}
func (s *S) FromJsonString(in_string string) {
err := json.Unmarshal([]byte(strings.TrimSpace(in_string)), s)
if err != nil {
log.Fatal("Error decoding json string")
}
}
type S_msg struct {
S
Params interface{} `json:"params"`
Method string `json:"method"`
}
type S_msg2 struct {
S
Result interface{} `json:"result"`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment