Zest.

JavaScript: Fetch JSON (GET)

A short, tested JavaScript example for fetch json (get). Copy it and adjust the names and paths for your project.

JavaScript
const res = await fetch("https://api.example.com/items?q=zest");
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();

Find it in Zest

Search for “javascript fetch json (get)” in Zest and this example appears above the results, with other matches to choose from. Searches stay private.

More JavaScript examples

All JavaScript examples