diff options
Diffstat (limited to 'rpc/json.go')
-rw-r--r-- | rpc/json.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/rpc/json.go b/rpc/json.go new file mode 100644 index 000000000..e467f9a34 --- /dev/null +++ b/rpc/json.go @@ -0,0 +1,20 @@ +package rpc + +import ( + "encoding/json" + "io" +) + +type jsonWrapper struct{} + +func (self jsonWrapper) Send(writer io.Writer, v interface{}) (n int, err error) { + var payload []byte + payload, err = json.Marshal(v) + if err != nil { + return 0, err + } + + return writer.Write(payload) +} + +var JSON jsonWrapper |