The DOMRectReadOnly method toJSON() returns a JSON representation of the DOMRectReadOnly object.
toJSON()
MDN Reference