From 3dc21b848c3c9d89f2e2f8ef9c9192e3526ac380 Mon Sep 17 00:00:00 2001
From: Mark McGranaghan
Date: Mon, 14 Sep 2015 08:50:10 -0700
Subject: [PATCH] Avoid double-pointer in Unmarshal
---
examples/json/json.go | 2 +-
examples/json/json.hash | 4 ++--
examples/json/json.sh | 2 +-
public/json | 8 ++++----
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/examples/json/json.go b/examples/json/json.go
index 137fe03..b3853f2 100644
--- a/examples/json/json.go
+++ b/examples/json/json.go
@@ -103,7 +103,7 @@ func main() {
// need for type assertions when accessing the decoded
// data.
str := `{"page": 1, "fruits": ["apple", "peach"]}`
- res := &Response2{}
+ res := Response2{}
json.Unmarshal([]byte(str), &res)
fmt.Println(res)
fmt.Println(res.Fruits[0])
diff --git a/examples/json/json.hash b/examples/json/json.hash
index 25df7f9..8d238b0 100644
--- a/examples/json/json.hash
+++ b/examples/json/json.hash
@@ -1,2 +1,2 @@
-9a3d67892b3930bceb1167b59d4d4f5527dadefc
-scgxBwACYx
+dee52e022a957b97c53fb2d2835653ef507502be
+WxRgpycMaH
diff --git a/examples/json/json.sh b/examples/json/json.sh
index 3714902..e9d0c9f 100644
--- a/examples/json/json.sh
+++ b/examples/json/json.sh
@@ -10,7 +10,7 @@ true
map[num:6.13 strs:[a b]]
6.13
a
-&{1 [apple peach]}
+{1 [apple peach]}
apple
{"apple":5,"lettuce":7}
diff --git a/public/json b/public/json
index 535869b..7c6528e 100644
--- a/public/json
+++ b/public/json
@@ -1,7 +1,7 @@
-
+
Go by Example: JSON
@@ -41,7 +41,7 @@ data types.
-
+
@@ -313,7 +313,7 @@ data.
|
str := `{"page": 1, "fruits": ["apple", "peach"]}`
- res := &Response2{}
+ res := Response2{}
json.Unmarshal([]byte(str), &res)
fmt.Println(res)
fmt.Println(res.Fruits[0])
@@ -364,7 +364,7 @@ stream JSON encodings directly to os.Writer s like
map[num:6.13 strs:[a b]]
6.13
a
-&{1 [apple peach]}
+{1 [apple peach]}
apple
{"apple":5,"lettuce":7}
|