Skip to content

Glossary: JavaScript Beyond the Basics

toJSON

A method a class can define to control its own JSON. `JSON.stringify` calls it and uses whatever it returns, which is how `LoyaltyAccount` saves its private history.

Where the book teaches it

Related terms

JSONReviver / replacer