Howto parse JSON using gdata client library?

99 views
Skip to first unread message

ShriJ

unread,
Aug 15, 2008, 8:49:30 PM8/15/08
to GData Python Client Library Contributors
I search alot but just couldn't find any simple example of how to use
the gdata python client library to parse a JSON file or JSON output
given as an HTTPResponse.

Any pointers or examples would be extremely useful.

-Shri

Takashi Matsuo

unread,
Aug 18, 2008, 9:14:44 PM8/18/08
to gdata-python-client-...@googlegroups.com
Hi Shri,

In my opinion, to parse a JSON format data stream is beyond the scope
of gdata python client library.
Perhaps you could use simplejson or something like that for it.

Regards,

-- Takashi Matsuo

Jeff S

unread,
Aug 20, 2008, 9:22:35 PM8/20/08
to GData Python Client Library Contributors
I agree with Takashi, you could use something like simplejson or
python-json or one of the other JSON libraries to parse the response
from the server. Usually these JSON libraries take in a string, and
you can use the gdata library to get the JSON for a feed or entry as a
string, then pass the string to a library.

To request the JSON as a string, you could do something like this

client = gdata.service.GDataService()
json_str = client.Get('http://www.google.com/base/feeds/snippets?
alt=json', converter=str)

Remeber to add 'alt=json' to the URL parameters when you make your
request :)

Happy coding,

Jeff

On Aug 18, 6:14 pm, "Takashi Matsuo" <matsuo.taka...@gmail.com> wrote:
> Hi Shri,
>
> In my opinion, to parse a JSON format data stream is beyond the scope
> of gdata python client library.
> Perhaps you could use simplejson or something like that for it.
>
> Regards,
>
> -- Takashi Matsuo
>
Reply all
Reply to author
Forward
0 new messages