๐Ÿ”ฐconverting objects

JS โŸฉ value โŸฉ object โŸฉ convert

about .toJSON()

  • Object.prototype does not define.toJSON().

  • JSON.stringify() looks for .toJSON() on any object it is asked to serialize.

  • if it exists, it is invoked, and the return value is serialized, instead of the original object.

Last updated

Was this helpful?