<div dir="ltr">Thanks Richard. I didn't know that the spec was precise about the JSON expr not going beyond the closing character. (I wasn't sure, for instance, if it would also include whitespace after that point.)<div><br></div><div>For logging, I bet it helps if people try to enforce the invariant that JSON text doesn't internally include newlines... </div><div><br></div><div>Best,</div><div> -Ryan</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, May 29, 2016 at 10:25 PM, Richard A. O'Keefe <span dir="ltr"><<a href="mailto:ok@cs.otago.ac.nz" target="_blank">ok@cs.otago.ac.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
On 30/05/16 5:53 AM, Stephen Tetley wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Ryan<br>
<br>
Isn't this a problem of JSON rather than it's parsers?<br>
<br>
That's too say I believe (but could easily be wrong...) that a file<br>
with multiple JSON objects would be ill-formed; it would be<br>
well-formed if the multiple objects were in a single top-level array.<br>
</blockquote>
<br></span>
"A file with multiple JSON objects would be ill-formed" -- it would be an<br>
ill-formed *what*?<br>
<br>
The media type application/json appears to describe a format<br>
containing precisely one JSON value, but RFC 7159 is otherwise silent<br>
about streams of JSON values.<br>
<br>
JSON is sometimes used as the format for entries in logs;<br>
it would be pretty useless for that if you couldn't have more than<br>
one in a sequence.<br>
<br>
If a JSON value is true, false, or null it ends at its last letter;<br>
if it's a string it ends at the closing double quote;<br>
if it's an array it ends at the closing ];<br>
if it's an object it ends at the closing };<br>
only if it is a number is there any need to check the next<br>
character, but then only one character needs to be checked,<br>
and thanks to the requirement that numbers be in ASCII, only<br>
one byte needs to be checked, there being no need to decode<br>
the next Unicode code point in full.<div class="HOEnZb"><div class="h5"><br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br></div>