Relaxed, or best-efforts JSON parser for Python?

Laura Creighton lac at openend.se
Mon Oct 12 07:01:25 EDT 2015


In a message of Sun, 11 Oct 2015 17:56:33 -0700, Victor Hooi writes:
>Hi,
>
>I'm attempting to parse MongoDB loglines.
>
>The formatting of these loglines could best be described as JSON-like...
>
>For example - arrays 
>
>Anyhow, say I had the following logline snippet:
>
>    { Global: { acquireCount: { r: 2, w: 2 } }, Database: { acquireCount: { w: 2 } }, Collection: { acquireCount: { w: 1 } }, oplog: { acquireCount: { w: 1 } } }
>
>This won't parse with json.loads() - the main issues is the missing quotation marks (") around the strings.
>
>My question, is there a more lenient, or relaxed JSON parser available for Python, that will try to do a best-efforts parsing of non-spec JSON?
>
>Cheers,
>Victor
>-- 
>https://mail.python.org/mailman/listinfo/python-list

Won't this 
http://blog.mongodb.org/post/85123256973/introducing-mtools
https://github.com/rueckstiess/mtools
https://pypi.python.org/pypi/mtools/1.1.3

be better? :)



More information about the Python-list mailing list