errors with json.loads

John Gordon gordon at panix.com
Wed Sep 20 18:56:02 EDT 2017


In <mailman.101.1505945630.2730.python-list at python.org> john polo <jpolo at mail.usf.edu> writes:

> JSONDecodeError: Expecting ':' delimiter: line 5 column 50 (char 161)

> ?json.loads says that the method is for deserializing "s", with "s" 
> being a string, bytes, or bytearray.

> In [24]: type(text)
> Out[24]: str

> So "text" seems to be a string. Why does json.loads return an error?

Because, although text is the right type, it does not contain a
valid json string.

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon at panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"




More information about the Python-list mailing list