Deep cloning objects defined by JSON.

Mark S. Miller erights at google.com
Sun Jan 29 10:32:42 PST 2012


On Sun, Jan 29, 2012 at 1:23 PM, David Bruant <bruant.d at gmail.com> wrote:

> Based on your description, it seems that the definition would be:
>
> JSON.clone = function(o){
>  return JSON.parse(JSON.stringify(o));
> }


Or possibly:

  JSON.clone = function(o, opt_reviver, opt_replacer) {
    return JSON.parse(JSON.stringify(o, opt_replacer), opt_reviver);
  };


-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120129/d3a703d4/attachment.html>


More information about the es-discuss mailing list