This is "approximately" the de-facto standard for dealing with BigNums and tons 
of other non-standard types.

var obj = JSON.parse("JSON formatted data");
var val = new BigNum(obj.sizeOfTheUniverseInCubicMeters);

JSON on the wire:
{
    "sizeOfTheUniverseInCubicMeters": "3.45e+445454545454545776767676676"
}

When TC-39 introduces BigNums in ES, this is the most likely way they will 
address this particular aspect.

For serializing BigNums, the toJSON() interface seems like a match made in 
heaven.

Ideally, JSON should have a parseWithSchema() method that automatically coerces 
string encapsulated data types like above into their proper native 
representation.

thanx,
Anders

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to