[Tutor] Parsing JSON with Python

Alan Gauld alan.gauld at btinternet.com
Fri Dec 12 00:23:01 CET 2014

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.

The input to loads() is a text string.
The implementation of load() apparently reads the file object
to produce a string which is passed to loads()

Alan G
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:

More information about the Tutor mailing list