You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@johnzon.apache.org by Mark Struberg <st...@yahoo.de.INVALID> on 2017/11/15 18:31:48 UTC
handling of empty input
Hi!
Sometimes we need to parse an empty file containing a JSON. Or some JSON object is optional and thus empty.
Currently we blow up with a non-expected char \u0000 (EOF)
But one doesn't know whether this was at the beginning or somewhere in the middle of the stream.
How do we intend to handle this best?
LieGrue,
strub
Re: handling of empty input
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Isnt null here for that in json?
Commons io can also be worth a look.
Le 15 nov. 2017 23:21, "Mark Struberg" <st...@yahoo.de.invalid> a écrit :
> Indeed. I also checked with the another JSON-P impl and they blow up with
> an internal exception as well.So it's probably fine.
> But still: how to best handle 'optional' data?
>
> LieGrue,strub
>
>
> On Wednesday, 15 November 2017, 21:57:04 CET, Romain Manni-Bucau <
> rmannibucau@gmail.com> wrote:
>
> If i get it is it an invalid json so we should blow up. The passed stream
> should handle a placeholder the parser can read if desired.
>
> Le 15 nov. 2017 19:32, "Mark Struberg" <st...@yahoo.de.invalid> a
> écrit :
>
> > Hi!
> >
> > Sometimes we need to parse an empty file containing a JSON. Or some JSON
> > object is optional and thus empty.
> >
> > Currently we blow up with a non-expected char \u0000 (EOF)
> > But one doesn't know whether this was at the beginning or somewhere in
> the
> > middle of the stream.
> >
> > How do we intend to handle this best?
> >
> > LieGrue,
> > strub
Re: handling of empty input
Posted by Mark Struberg <st...@yahoo.de.INVALID>.
Indeed. I also checked with the another JSON-P impl and they blow up with an internal exception as well.So it's probably fine.
But still: how to best handle 'optional' data?
LieGrue,strub
On Wednesday, 15 November 2017, 21:57:04 CET, Romain Manni-Bucau <rm...@gmail.com> wrote:
If i get it is it an invalid json so we should blow up. The passed stream
should handle a placeholder the parser can read if desired.
Le 15 nov. 2017 19:32, "Mark Struberg" <st...@yahoo.de.invalid> a écrit :
> Hi!
>
> Sometimes we need to parse an empty file containing a JSON. Or some JSON
> object is optional and thus empty.
>
> Currently we blow up with a non-expected char \u0000 (EOF)
> But one doesn't know whether this was at the beginning or somewhere in the
> middle of the stream.
>
> How do we intend to handle this best?
>
> LieGrue,
> strub
Re: handling of empty input
Posted by Romain Manni-Bucau <rm...@gmail.com>.
If i get it is it an invalid json so we should blow up. The passed stream
should handle a placeholder the parser can read if desired.
Le 15 nov. 2017 19:32, "Mark Struberg" <st...@yahoo.de.invalid> a écrit :
> Hi!
>
> Sometimes we need to parse an empty file containing a JSON. Or some JSON
> object is optional and thus empty.
>
> Currently we blow up with a non-expected char \u0000 (EOF)
> But one doesn't know whether this was at the beginning or somewhere in the
> middle of the stream.
>
> How do we intend to handle this best?
>
> LieGrue,
> strub