support for circular objects with toJSON