Skip to content

Instantly share code, notes, and snippets.

@robertu7
Created February 5, 2016 01:57
Show Gist options
  • Save robertu7/9158a9995d6d43867f59 to your computer and use it in GitHub Desktop.
Save robertu7/9158a9995d6d43867f59 to your computer and use it in GitHub Desktop.
Javascript JSON.parse and JSON.stringify
// Deep Copy https://jsperf.com/deep-copy-vs-json-stringify-json-parse
var copy = JSON.parse(JSON.stringify(targetObject))
// Find and Modify Deeply Nested Object
JSON.parse(JSON.stringify(targetObject).replace(/replaceThis/g, 'toThis'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment