Support for JSON-C

3 views
Skip to first unread message

Jeff S

unread,
Feb 9, 2010, 7:42:09 PM2/9/10
to GData Python Client Library Contributors
Hi all,

A couple of Google Data services have recently added support for a
new, more compact, JSON based format which I think this library should
support. Here's a recent announcement on the YouTube API blog for more
details:

http://apiblog.youtube.com/2010/02/new-format-for-json-results.html

There are a few ways that this format could be handled, but one
approach that I like is a new class which wraps a simplejson style
dict and allows access to members as follows:

x.data.items[0].favorite_count

Also this class supports the more typical simplejson style access
pattern. So you could also do:

x['data']['items'][0]['favoriteCount']

Here's my implementation:

http://gdata-python-client-library-contributors.googlegroups.com/web/jsonc_support.diff?gda=jN-LtkQAAAD1fA9wddfklbutSdL87OJ5qblWA0S0SM-MbPZ7AStDMGhrsU9nI-P6IbqbzNHRs7tV6u9SiETdg0Q2ffAyHU-dzc4BZkLnSFWX59nr5BxGqA

Please let me know what you think. Is this easy to use? Too much
magic? Would you rather just use the simplejson/json module?

Thank you,

Jeff

Eric (Google)

unread,
Feb 11, 2010, 5:13:30 PM2/11/10
to GData Python Client Library Contributors
Looks good Jeff. I like :)

On Feb 9, 4:42 pm, Jeff S <j...@google.com> wrote:
> Hi all,
>
> A couple of Google Data services have recently added support for a
> new, more compact, JSON based format which I think this library should
> support. Here's a recent announcement on the YouTube API blog for more
> details:
>
> http://apiblog.youtube.com/2010/02/new-format-for-json-results.html
>
> There are a few ways that this format could be handled, but one
> approach that I like is a new class which wraps a simplejson style
> dict and allows access to members as follows:
>
> x.data.items[0].favorite_count
>
> Also this class supports the more typical simplejson style access
> pattern. So you could also do:
>
> x['data']['items'][0]['favoriteCount']
>
> Here's my implementation:
>

> http://gdata-python-client-library-contributors.googlegroups.com/web/...

Jeff S

unread,
Feb 11, 2010, 8:51:28 PM2/11/10
to GData Python Client Library Contributors
Thanks for the review Eric. I've checked this in as revision 947.

-Jeff

Reply all
Reply to author
Forward
0 new messages