parsing json output
Tim Roberts
timr at probo.com
Wed Mar 19 03:26:34 EDT 2008
Gowri <gowricp at gmail.com> wrote:
>
>I have a service running somewhere which gives me JSON data.
>...
>This prints a whole bunch of nonsense as expected.
It's not nonsense. It's JSON.
>I use cjson and am
>unable to figure out how to print this json response
You are already printing the JSON response. That's what that script does.
>and I guess if I
>can do this, parsing should be straightforward? doing a
>cjson.decode(str(repsonse)) does not work.
If response.read() returns the JSON string, as you show above, one might
expect
cjson.decode(response.read())
to parse it. Have you read the cjson documentation?
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-list
mailing list