ujson utf8 content
Posted: Mon Jul 20, 2020 6:08 pm
I cannot seem to find a good solution to my problem - accented characters in my JSON object. Here is a minimalistic example:
The documentation I found does not detail any encoding options: https://docs.micropython.org/en/latest/ ... ujson.html
Google did not give any relevant hits, maybe my keywords were not useful.
Thanks.
Code: Select all
import ujson
exampleJSON = ujson.loads(
'{ \n' \
'"Name": "Á" \n'\
'}\n')
>>> exampleJSON
{'Name': '\xc1'}
>>> print(bytes(ujson.dumps(exampleJSON), 'utf-8'))
b'{"Name": "\xc3\x81"}'
Google did not give any relevant hits, maybe my keywords were not useful.
Thanks.