Closed CurtTilmes closed 5 years ago
I've finally put in a solution for this, but it follows neither approach. You can now catch an exception called X::JSON::AdditionalContent
, which gives you the parse result, and tells you where in the source string you can resume parsing for the next one. hope that helps! otherwise, feel free to re-open this issue
I realize this is my problem, not yours, but an external provider who is supposed to send JSON is actually sending me multiple JSON objects, Think something like this:
JSON::Fast
correctly throws an Exception because of the extra garbage after a successful parse.I am trying to figure out the right approach to solve my problem. Though I could fork
JSON::Fast
and make aJSON::Fast::Multi
or some such, that would give me all sorts of other problems, keeping things in sync, etc.I am wondering if you would be open to one of two approaches:
1) Add a
:multi
option tofrom-json()
that instead of dying would just keep parsing and return all the objects in an array, something like this:2) Leave everything exactly as it is, but add an extra
from-json-multi()
function something like this: