0
#!/opt/homebrew/bin/python3
#-*-coding:utf8-*-
#python version 3.11.4

import json5
import json

d = json5.loads('{"\\ud83d\\ude03": "ok"}')
print(d) # output: {'\ud83d\ude03': 'ok'}

d = json.loads('{"\\ud83d\\ude03": "ok"}')
print(d) # output: {'': 'ok'}

Is this a bug, a feature, or is my usage wrong?

surrogate pair is supported which described in this document: RFC 8259 - The JavaScript Object Notation (JSON) Data .... JSON5 is a superset of JSON,it should be compatible with json. so i think it's not a feature.

Green
  • 121
  • 1
  • 3
  • That looks like a `json5` package bug. [The JSON5 spec](https://spec.json5.org/#escapes) matches the JSON spec on this point. – user2357112 Jul 31 '23 at 04:20

0 Answers0