Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL JSON field type with string should decode in python3 #272

Open
howmp opened this issue Jul 10, 2018 · 1 comment
Open

MySQL JSON field type with string should decode in python3 #272

howmp opened this issue Jul 10, 2018 · 1 comment

Comments

@howmp
Copy link

howmp commented Jul 10, 2018

Table:

CREATE TABLE test (id int, value json);

With data:

id value
1 {"string1":"string2"}

But event's values in python3 is :

{"id":1,"value":{b"string1":b"string2"}

And when use json.dumps will raise TypeError: keys must be a string

@howmp
Copy link
Author

howmp commented Jul 10, 2018

According to rfc7159 : https://tools.ietf.org/html/rfc7159#section-8.1

JSON text SHALL be encoded in UTF-8, UTF-16, or UTF-32. The default
encoding is UTF-8

So should decode as utf-8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant