python: Decoding multiple JSON strings in a file

I wanted to be able to decode a stream that had multiple, undelineated, JSON string representations in it. For example, a file like this:

[1, 2, 3] [4, 5, 6] [7, 8] [9, 10, 11, 12]

Which has multiple JSON arrays in it, separated only by (optional) whitespace. Perhaps they might be separated by other characters in other applications (e.g., comma separated JSON strings)

First stop, as always, was stackoverflow, which had some relevant answers, like this one:

I decided to write a variant of the several “read it in chunks, try to JSONDecode it, keep reading more if it doesn’t yet parse” solutions. Here is my take at this problem, as a gist:

Posting this in the hopes, as always, that someday someone will be looking for something like this and stumble across it via google (if I’ve somehow worked enough key phrases into this posting)