Some rudimentary protocol benchmarks for go.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

28 lines
406 B

package json
import (
"encoding/json"
)
type JsonTest struct {
Version float32
Method string
Params []string
}
func JsonPack() {
json.Marshal(&JsonTest{
Version: 2.0,
Method: "echo",
Params: []string{
"some",
"params",
"here",
},
})
}
func JsonUnpack() {
var test JsonTest
json.Unmarshal([]byte(`{"Version":2.0,"Method":"echo","params":["some","params","here"]}`), &test)
}