[Haskell-cafe] JSON parser that returns the rest of the string that was not used
adam at bergmark.nl
Sun May 29 20:28:01 UTC 2016
For aeson, use the Parser/attoparsec module
On Sun, May 29, 2016 at 8:48 PM, Nikita Volkov <nukasu.kanaka at gmail.com>
> I know of at least two packages providing the incremental JSON parsing
> Being the author of the latter one I recommend checking out both.
> вс, 29 мая 2016 г. в 20:10, Ryan Newton <rrnewton at gmail.com>:
>> As someone who spent many years putting data in S-expression format, it
>> seems natural to me to write multiple S-expressions (or JSON objects) to a
>> file, and expect a reader to be able to read them back one at a time.
>> This seems comparatively uncommon in the JSON world. Accordingly, it
>> looks like the most popular JSON parsing lib, Aeson, doesn't directly
>> provide this functionality. Functions like decode just return a "Maybe a",
>> not the left-over input, meaning that you would need to somehow split up
>> your multi-object file before attempting to parse, which is annoying and
>> error prone.
>> It looks like maybe you can get Aeson to do what I want by dropping down
>> to the attoparsec layer and messing with IResult.
>> But is there a better way to do this? Would this be a good convenience
>> routine to add to aeson in a PR? I.e. would anyone else use this?
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe