« Posts tagged json

Javascript Complete Object Serialization (JSON) with Methods (Object Type) and Circular References

Object serialization can be a powerful feature for transferring or persisting objects, but when using JSON  serialization with JSON.stringify()  you have to keep in mind some things:

  • Values that do not have a representation in JSON (such as functions and undefined) are excluded
  • Objects are stored as ‘Object’ without a prototype reference
  • Circular references within an object can cause an error: too much recursion

If you want to have those features get cycle.js do it like this: