const obj = { hello: "world" };
const request = new Request("/myEndpoint", {
method: "POST",
body: JSON.stringify(obj),
});
request.json().then((data) => {
// do something with the data sent in the request
});Request: json() method / notebook
Request: json() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.