# HG changeset patch # User Bob Ippolito <bob@redivi.com> # Date 1146106872 0 # Thu Apr 27 03:01:12 2006 +0000 # Node ID 8cda38283e68c17241d4a1f9eca80c4af5be1a17 # Parent e205a697dcf757c138188eeeb516c90772b4d89a check for dupe keys git-svn-id: http://simplejson.googlecode.com/svn/trunk@24 a4795897-2c25-0410-b006-0d3caba88fa1 diff --git a/simplejson/decoder.py b/simplejson/decoder.py --- a/simplejson/decoder.py +++ b/simplejson/decoder.py @@ -138,6 +138,8 @@ value, end = iterscan(s, idx=end, context=context).next() except StopIteration: raise ValueError(errmsg("Expecting object", s, end)) + if key in pairs: + raise ValueError(errmsg("Duplicate property name", s, end)) pairs[key] = value end = _w(s, end).end() nextchar = s[end:end + 1] diff --git a/simplejson/tests/test_fail.py b/simplejson/tests/test_fail.py --- a/simplejson/tests/test_fail.py +++ b/simplejson/tests/test_fail.py @@ -48,6 +48,8 @@ '["Bad value", truth]', # http://json.org/JSON_checker/test/fail24.json "['single quote']", + # Not part of the JSON spec + '{"a": 1, "a": 1}', ] SKIPS = {