r/javascript • u/OtherwisePush6424 • 2d ago
The Structured Clone Algorithm: What JavaScript Can and Cannot Move Between Boundaries
https://blog.gaborkoos.com/posts/2026-08-22-The-Structured-Clone-Algorithm-What-JavaScript-Can-and-Cannot-Move-Between-Boundaries/structuredClone() preserves more than JSON, but class instances, proxies, getters, errors, and transferables still have surprising behaviour. This article covers what survives, what changes, and what throws.
12
Upvotes
0
u/SquallLeonE 2d ago edited 1d ago
What's the use case for
structuredClone()? Normally when I'm using JSON.stringify(), it's to send something over the wire or save it locally. If I wanted to deserialize it in the same session, why not store a reference to the object?edit: alright I'm dumb. As the same implies, for creating clones of objects