JSON.stringify crashes for circular objects; also it includes all the properties indiscriminately. 

Having custom toJSON allows us to only expose those properties that include public data.