summaryrefslogtreecommitdiff
path: root/libgo/go/encoding/json/stream.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/encoding/json/stream.go')
-rw-r--r--libgo/go/encoding/json/stream.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/libgo/go/encoding/json/stream.go b/libgo/go/encoding/json/stream.go
index 7d1cc5f119c..9592467d25b 100644
--- a/libgo/go/encoding/json/stream.go
+++ b/libgo/go/encoding/json/stream.go
@@ -26,6 +26,10 @@ func NewDecoder(r io.Reader) *Decoder {
return &Decoder{r: r}
}
+// UseNumber causes the Decoder to unmarshal a number into an interface{} as a
+// Number instead of as a float64.
+func (dec *Decoder) UseNumber() { dec.d.useNumber = true }
+
// Decode reads the next JSON-encoded value from its
// input and stores it in the value pointed to by v.
//
@@ -74,7 +78,7 @@ Input:
// scanEnd is delayed one byte.
// We might block trying to get that byte from src,
// so instead invent a space byte.
- if v == scanEndObject && dec.scan.step(&dec.scan, ' ') == scanEnd {
+ if (v == scanEndObject || v == scanEndArray) && dec.scan.step(&dec.scan, ' ') == scanEnd {
scanp += i + 1
break Input
}