by javajosh · 10y ago · 0 comments
The down-side is that a consumer has to run a full-blown eval() (as opposed to the more restricted JSON.parse()). This isn't that much of a downside in a typical webapp since you have full control over the browser process anyway, but it's deadly for cross-domain.
The upside is considerable for certain data-structures that are hard to represent in JSON efficiently, e.g. with a lot of denormalization.
A key concern for me is runtime efficiency, particularly compared to JSON.stringify.
As far as efficiency, I'd think for most uses the issue would be on the JSON.parse end. In this case, lave might be more efficient, since JSON reviving often ends up creating temporary objects that need to GC'ed after reification.
Also, it would be interesting to support other data-types, such as the ones that come with Immutable.js. That would be slick.