Skip to content

Instantly share code, notes, and snippets.

@1900
Created September 5, 2012 08:47
Show Gist options
  • Save 1900/3633517 to your computer and use it in GitHub Desktop.
Save 1900/3633517 to your computer and use it in GitHub Desktop.
simplejson Decoding demo
>>> import simplejson as json
>>> obj = [u'foo', {u'bar': [u'baz', None, 1.0, 2]}]
>>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj
True
>>> json.loads('"\\"foo\\bar"') == u'"foo\x08ar'
True
>>> from StringIO import StringIO
>>> io = StringIO('["streaming API"]')
>>> json.load(io)[0] == 'streaming API'
True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment