method URL.toJSONURL.toJSON(): stringThe toJSON() method of the URL interface returns a JSON representation of the URL. ExamplesExample 1 const myURL = new URL('https://example.org/foo'); console.log(myURL.toJSON()); // Logs "https://example.org/foo" Return TypestringSeehttps://developer.mozilla.org/docs/Web/API/URL/toJSON