jsonyx.allow.SURROGATES

jsonyx.allow.SURROGATES = frozenset({'surrogates'})

Allow unpaired surrogates in strings.

>>> import jsonyx as json
>>> import jsonyx.allow
>>> json.loads('"\ud800"', allow=jsonyx.allow.SURROGATES)
'\ud800'
>>> json.dump("\ud800", allow=jsonyx.allow.SURROGATES, ensure_ascii=True)
"\ud800"

Tip

If you’re not using read() or write(), you still need to use ensure_ascii=True or set the unicode error handler to "surrogatepass".