Skip to content

Latest commit

 

History

History
35 lines (27 loc) · 952 Bytes

README.md

File metadata and controls

35 lines (27 loc) · 952 Bytes

Build Status

Relaxed JSON

pip install relaxedjson

See http://pythonhosted.org/relaxedjson/

A more relaxed JSON parser that supports missing quotes on keys.

Standard JSON:

>>> import json
>>> json.loads('{moose: "goose"}')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../python2.7/json/__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File ".../python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File ".../python2.7/json/decoder.py", line 380, in raw_decode
    obj, end = self.scan_once(s, idx)
ValueError: Expecting property name: line 1 column 2 (char 1)

Relaxed JSON:

>>> import relaxedjson
>>> relaxedjson.parse('{moose: "goose"}')
{'moose': 'goose'}