aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/json.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-10-21 19:24:48 +0800
committerobscuren <geffobscura@gmail.com>2014-10-21 19:24:48 +0800
commit10b252dd0517175117d8d4a8ef30b3689a10eda5 (patch)
tree50c151da01936eb169d4ee6c3a1a717dfd9aabb1 /rpc/json.go
parent097ba56df59293f9225a8ecdc9e1c43a5ad891bb (diff)
downloadgo-tangerine-10b252dd0517175117d8d4a8ef30b3689a10eda5.tar
go-tangerine-10b252dd0517175117d8d4a8ef30b3689a10eda5.tar.gz
go-tangerine-10b252dd0517175117d8d4a8ef30b3689a10eda5.tar.bz2
go-tangerine-10b252dd0517175117d8d4a8ef30b3689a10eda5.tar.lz
go-tangerine-10b252dd0517175117d8d4a8ef30b3689a10eda5.tar.xz
go-tangerine-10b252dd0517175117d8d4a8ef30b3689a10eda5.tar.zst
go-tangerine-10b252dd0517175117d8d4a8ef30b3689a10eda5.zip
WIP RPC interface
Diffstat (limited to 'rpc/json.go')
-rw-r--r--rpc/json.go20
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