Re: additional comments Amirouche Boubekki 20 Jun 2020 07:30 UTC

Le jeu. 28 mai 2020 à 16:25, John Cowan <> a écrit :
> I contributed to that RFC and suggested the use of RS (record separator).  The idea of having such a thing is that if there is a syntax error in a particular JSON value, a stream processor can skip down to the next value reliably, which is not the case for whitespace..  I urge all authors of JSON parsers to check for and ignore an RS before a top-level JSON value is read (it may be preceded or followed by whitespace, of course).

If we make RS part of whitespace and allowed in JSON text unlike what
the specification says, the implementation is similar to
json-read-lines. Something along the line of:

(call-with-input-string "[1]\n[2]\n[3]\n"
  (lambda (port)
    (let loop ((obj (json-read port))
                   (out '()))
      (if (eof-object? obj)
        (reverse out)
        (loop (json-read port) (cons obj out)))))

The only difference would be to wrap json-read inside a guard and skip

Mind the fact that json-read-lines is not part of the specification, so far.