Ammar Askar <am...@ammaraskar.com> added the comment:
This is intentional, the parsed in JSON doesn't necessarily have to have an object at the root. This is also what allows you to do: >>> json.loads("[]") [] This behavior is also consistent with browsers, try this in your browser's dev console: > JSON.parse("123") 123 > JSON.parse('"123"') "123" > JSON.parse('[]') [] More technically, look at the JSON standard here: https://www.json.org/ As you can see, the root value is an "element", which is of type "value" surrounded by some whitespace. Values can be any of these: value object array string number "true" "false" "null" ---------- nosy: +ammar2 resolution: -> not a bug stage: -> resolved status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34721> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com