Skip to content

Instantly share code, notes, and snippets.

@jdob
Created January 29, 2013 14:14
Show Gist options
  • Select an option

  • Save jdob/4664531 to your computer and use it in GitHub Desktop.

Select an option

Save jdob/4664531 to your computer and use it in GitHub Desktop.
In [1]: import json
In [2]: f = '''{
...: "skip_pkg_tags" : true,
...: }
...: '''
In [3]: json.loads(f)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/jdob/<ipython-input-3-37fa654956bd> in <module>()
----> 1 json.loads(f)
/usr/lib64/python2.7/json/__init__.pyc in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
324 parse_int is None and parse_float is None and
325 parse_constant is None and object_pairs_hook is None and not kw):
--> 326 return _default_decoder.decode(s)
327 if cls is None:
328 cls = JSONDecoder
/usr/lib64/python2.7/json/decoder.pyc in decode(self, s, _w)
364
365 """
--> 366 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
367 end = _w(s, end).end()
368 if end != len(s):
/usr/lib64/python2.7/json/decoder.pyc in raw_decode(self, s, idx)
380 """
381 try:
--> 382 obj, end = self.scan_once(s, idx)
383 except StopIteration:
384 raise ValueError("No JSON object could be decoded")
ValueError: Expecting property name: line 3 column 1 (char 27)
In [4]: f = '''{
"skip_pkg_tags" : true
}
'''
In [5]: json.loads(f)
Out[5]: {u'skip_pkg_tags': True}
In [6]:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment