[Tutor] Parsing JSON with Python
Ben Finney
ben+python at benfinney.id.au
Fri Dec 12 00:29:38 CET 2014
Alan Gauld <alan.gauld at btinternet.com> writes:
> On 11/12/14 23:15, Ben Finney wrote:
>
> >> *array = json.load( { "name": "Joe", "address": "111 Street" } )*
> >
> > You are passing a Python dict value to the function. JSON is a
> > serialisation format, and the input to ‘json.load’ must be a text
> > string.
>
> Nope, its a file-like object.
Fair enough, I didn't check the ‘json.load’ documentation. Thank you for
the correction.
I suspect the OP wasn't aware they specified a Python dict, though,
which is the main point.
--
\ “Never use a long word when there's a commensurate diminutive |
`\ available.” —Stan Kelly-Bootle |
_o__) |
Ben Finney
More information about the Tutor
mailing list