diff --git a/extmod/modujson.c b/extmod/modujson.c
index 70daf81043461d76e2295c2e454eae3bb941a70a..5023d815132b06ce94958c2e5dfba322e5dec99d 100644
--- a/extmod/modujson.c
+++ b/extmod/modujson.c
@@ -81,6 +81,9 @@ STATIC mp_obj_t mod_ujson_loads(mp_obj_t obj) {
             case ',':
             case ':':
             case ' ':
+            case '\t':
+            case '\n':
+            case '\r':
                 s += 1;
                 goto cont;
             case 'n':
diff --git a/tests/extmod/ujson_loads.py b/tests/extmod/ujson_loads.py
index 187917f8212eb1871571b3c9e877f1891390e505..05bd62a9b29ca787d824862a36e497a68e2798a5 100644
--- a/tests/extmod/ujson_loads.py
+++ b/tests/extmod/ujson_loads.py
@@ -30,3 +30,6 @@ my_print(json.loads('{}'))
 my_print(json.loads('{"a":true}'))
 my_print(json.loads('{"a":null, "b":false, "c":true}'))
 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}'))