diff --git a/Lib/json/decoder.py b/Lib/json/decoder.py index c5d9ae2d0d5d04..17caf7001b41a5 100644 --- a/Lib/json/decoder.py +++ b/Lib/json/decoder.py @@ -203,6 +203,8 @@ def JSONObject(s_and_end, strict, scan_once, object_hook, object_pairs_hook, end = _w(s, end).end() nextchar = s[end:end + 1] end += 1 + if nextchar == '}': + raise JSONDecodeError("Trailing commas are not allowed in JSON objects.") if nextchar != '"': raise JSONDecodeError( "Expecting property name enclosed in double quotes", s, end - 1)