Hi Nikoms, thanks for stopping by with your question about JSON.parse() and JSON.stringify().

I just updated the article to include 3 more methods of deep copying in JavaScript: writing a custom function, JSON.parse/JSON.stringify, and the rfdc (Really Fast Deep Clone) library.

Tuan Tran asked the same question in the response to the article, and he got a few responses with some good points. Check those out here:

Circular references are one issue, but not the only one — parse and stringify do not play nice with any data types that are not primitive values.

JSON.parse() and JSON.stringify() will only work for nested objects and arrays that contain just primitive values, objects, and arrays.

For example, Date and RegExp objects will not work correctly.

I illustrate some of these examples of JSON.parse() and JSON.stringify() using code in my updated article on how to deep copy in JavaScript.

🤓 The physical therapist who writes JavaScript 💪 Web Developer 😎 Mentor 🧠 DPT 😄 SEO Expert 😁 React 😆 Jamstack 💬 Ask me anything 👉 DoctorDerek.com 👈

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store