This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ammar2
Recipients ammar2, jaihong
Date 2018-09-18.13:26:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1537277214.23.0.956365154283.issue34721@psf.upfronthosting.co.za>
In-reply-to
Content
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"
History
Date User Action Args
2018-09-18 13:26:54ammar2setrecipients: + ammar2, jaihong
2018-09-18 13:26:54ammar2setmessageid: <1537277214.23.0.956365154283.issue34721@psf.upfronthosting.co.za>
2018-09-18 13:26:54ammar2linkissue34721 messages
2018-09-18 13:26:54ammar2create