JSON support for BigInt in Chrome/V8

Ranando King kingmph at gmail.com
Sat Jul 28 16:07:45 UTC 2018

Don't get me wrong. I didn't suggest a means of extending JSON. I suggested
a means of consistently and easily reversibly serializing anything that is
not natively handled by JSON already. I think JSON is a fairly complete
syntax for most purposes. I wish it had a reference type so that recursive
structures could be encoded as well, but the suggestion I've just made can
even be used to encode that.

On Sat, Jul 28, 2018 at 10:52 AM Anders Rundgren <
anders.rundgren.net at gmail.com> wrote:

> On 2018-07-28 16:52, Ranando King wrote:
> > Why not just use DataURL syntax, something like this:
> >
> > ```js
> > {
> >    "field1":
> "data:json/bigint,12345678901234567890123456789012345678901234567890123456789012345678901234567890",
> >    ...
> > }
> > ```
> > This way, even as other objects pop up to be serialized, all that would
> be needed is another mime type in the format "json/<typename>". I could
> even see letting the "<typename>" portion hold the non-lowercased, original
> class name to make it even faster to deserialize such fields without
> knowing all possible mime types in advance. Still 100% compatible with
> existing JSON. Still 100% human readable/writable. Very easy to implement,
> and self consistent.
> >
> I think the issue is rather: What problem do we want to solve?
> It is pretty obvious that there is no "perfect" solution.
> XML proves that there is no need for explicit type information in an
> information exchange format. Most sophisticated systems map keys in some
> way making explicit type information redundant.  That JSON do have a set of
> distinct data types is great, but extending that type scheme outside of the
> original JavaScript core, IMO only creates problems.  Nobody (in their
> right mind) would even think of designing a typed format where everything
> from a byte to BigDecimal would be represented as a single type.
> Anders
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180728/244fde09/attachment.html>

More information about the es-discuss mailing list