Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
const res = await fetch("/api/data"); // Choose one: const json = await res.json(); // parse JSON const text = await res.text(); // raw string const blob = await res.blob(); // binary file const ab = await res.arrayBuffer(); // raw bytes const form = await res.formData(); // form fields // Clone to read twice const clone = res.clone(); const [json2, text2] = await Promise.all([res.json(), clone.text()]);
Result
Open