aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/json/stream.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/encoding/json/stream.go')
-rw-r--r--src/encoding/json/stream.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/encoding/json/stream.go b/src/encoding/json/stream.go
index 76788f5fe7..f6b62c4cf6 100644
--- a/src/encoding/json/stream.go
+++ b/src/encoding/json/stream.go
@@ -35,6 +35,11 @@ func NewDecoder(r io.Reader) *Decoder {
// Number instead of as a float64.
func (dec *Decoder) UseNumber() { dec.d.useNumber = true }
+// DisallowUnknownFields causes the Decoder to return an error when the destination
+// is a struct and the input contains object keys which do not match any
+// non-ignored, exported fields in the destination.
+func (dec *Decoder) DisallowUnknownFields() { dec.d.disallowUnknownFields = true }
+
// Decode reads the next JSON-encoded value from its
// input and stores it in the value pointed to by v.
//