Skip to content

Commit 58894bd

Browse files
committed
Update text and output of json example slightly
1 parent 7951241 commit 58894bd

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

examples/json/json.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ func main() {
123123
d := map[string]int{"apple": 5, "lettuce": 7}
124124
enc.Encode(d)
125125

126-
// We can also decode JSON directly from `os.Reader`
126+
// Streaming reads from `os.Reader`s like `os.Stdin`
127+
// or HTTP request bodies is done with `json.Decoder`.
127128
dec := json.NewDecoder(strings.NewReader(str))
128129
res1 := response2{}
129130
dec.Decode(&res1)
130131
fmt.Println(res1)
131-
fmt.Println(res1.Fruits[1])
132132
}

examples/json/json.hash

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
75a5664321dafe10fa623c187b90f079c5319a3c
2-
jR7IEUPQF8T
1+
db25fb3a8b52215441ebe0a5d6a4d4f1a8be5917
2+
zwf9dZ4pUPW

examples/json/json.sh

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ a
1313
{1 [apple peach]}
1414
apple
1515
{"apple":5,"lettuce":7}
16+
{1 [apple peach]}
1617

1718

1819
# We've covered the basic of JSON in Go here, but check

public/json

+6-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)