Skip to content
Snippets Groups Projects
Commit 444331c0 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

modujson: .loads(): Handle more whitespace characters.

parent 1f04336b
No related branches found
No related tags found
No related merge requests found
...@@ -81,6 +81,9 @@ STATIC mp_obj_t mod_ujson_loads(mp_obj_t obj) { ...@@ -81,6 +81,9 @@ STATIC mp_obj_t mod_ujson_loads(mp_obj_t obj) {
case ',': case ',':
case ':': case ':':
case ' ': case ' ':
case '\t':
case '\n':
case '\r':
s += 1; s += 1;
goto cont; goto cont;
case 'n': case 'n':
......
...@@ -30,3 +30,6 @@ my_print(json.loads('{}')) ...@@ -30,3 +30,6 @@ my_print(json.loads('{}'))
my_print(json.loads('{"a":true}')) my_print(json.loads('{"a":true}'))
my_print(json.loads('{"a":null, "b":false, "c":true}')) my_print(json.loads('{"a":null, "b":false, "c":true}'))
my_print(json.loads('{"a":[], "b":[1], "c":{"3":4}}')) my_print(json.loads('{"a":[], "b":[1], "c":{"3":4}}'))
# whitespace handling
my_print(json.loads('{\n\t"a":[]\r\n, "b":[1], "c":{"3":4} \n\r\t\r\r\r\n}'))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment