[Cialug] What's a JSON Document?

Todd Walton tdwalton at gmail.com
Sun Sep 2 13:12:16 UTC 2018


On Thu, Aug 30, 2018 at 6:03 PM David W. Body <davidbody at bigcreek.com>
wrote:

> A practical way to find out what is and isn't valid JSON is to use
> JavaScript's JSON.parse() and JSON.stringify() functions.


Well, yeah, but those functions only accept a JSON "text", and it occurs to
me now that my example is basically two JSON texts. So of course those
functions will say it's invalid JSON. But an argument could be made that
that's because of a (reasonable) technical limitation of those functions.

Anyway, I think I get it now. A file with two objects separated by
whitespace is not a valid JSON text, but it is two JSON texts. It's just
that it's "problematic" to put two JSON texts in one file/document/blah.

--
Todd


More information about the Cialug mailing list