const point = new DOMPointReadOnly(10, 20);
const json = point.toJSON();
console.log(json);
// { x: 10, y: 20, z: 0, w: 1 }
console.log(typeof json); // "object"DOMPointReadOnly: toJSON() method / notebook
DOMPointReadOnly: toJSON() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const pointJSON = JSON.stringify(point);
console.log(pointJSON);