You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
loads() accepts any character in an unquoted key when it is written as a \u escape #161
json5.loads does not check the character behind a \uXXXX escape in an unquoted key, so keys the spec forbids are accepted:
importjson5json5.loads(r"{\u0301: 1}") # a combining mark as the first characterjson5.loads(r"{\u002d: 1}") # {'-': 1}json5.loads(r"{a\u0020b: 1}") # {'a b': 1}
JSON5 §3 takes unquoted keys from ECMAScript 5.1 §7.6, which says a UnicodeEscapeSequence in an IdentifierName cannot put a character there that would be illegal if written literally. The same keys written literally ({-: 1}, {a b: 1}) are rejected, and the reference json5 for JavaScript (2.2.3) rejects {\u0301: 1} and {\u002d: 1}.
I found this while running a set of JSON5 test files through several parsers. Tested with json5 0.17.3 on Python 3.14.
In perhaps good news, I think this was fixed with PR #125 on trunk, which hasn't been released yet (along w/ a slew of other fixes), and your examples all fail on trunk, so I'm closing this. It should be closed as a duplicate, but I don't think a bug was fixed for that, just the PR.
If you're still seeing issues on trunk, please feel free to re-open this. If you're trying to do a bunch of conformance testing, or, as you said, just comparing implementations, please use the latest code on trunk if you can to verify things are still issues.
Activity
dpranke commentedon Nov 11, 2026
Hi! thanks for the bug report :).
In perhaps good news, I think this was fixed with PR #125 on trunk, which hasn't been released yet (along w/ a slew of other fixes), and your examples all fail on trunk, so I'm closing this. It should be closed as a duplicate, but I don't think a bug was fixed for that, just the PR.
dpranke commentedon Nov 11, 2026
If you're still seeing issues on trunk, please feel free to re-open this. If you're trying to do a bunch of conformance testing, or, as you said, just comparing implementations, please use the latest code on trunk if you can to verify things are still issues.
Cheers!