Complete the code to fetch data from an API in Astro frontmatter.
---
const response = await fetch([1]);
const data = await response.json();
---In Astro frontmatter, you use fetch with the API URL as a string to get data.
Complete the code to handle the JSON response correctly in Astro frontmatter.
--- const response = await fetch('https://api.example.com/data'); const data = await response.[1](); ---
text() which returns raw text.blob() or xml() which are not for JSON.The json() method parses the response body as JSON.
Fix the error in the Astro frontmatter fetch code to await the fetch call.
--- const response = [1]('https://api.example.com/data'); const data = await response.json(); ---
json().then() without proper async handling.You must await the fetch call to get the response before calling json().
Fill both blanks to create a frontmatter fetch that gets JSON and extracts the 'items' property.
--- const response = await fetch([1]); const data = await response.[2](); const items = data.items; ---
text() instead of json().Use the correct API URL and json() to parse the response.
Fill all three blanks to fetch data, parse JSON, and map item names in Astro frontmatter.
--- const response = await fetch([1]); const data = await response.[2](); const names = data.items.map(item => item.[3]); ---
Fetch from the correct URL, parse JSON, then map the 'name' property from each item.
