Created
March 15, 2016 02:51
-
-
Save wozz/fa287d864d44e771e204 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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