This is an API that gives you a JSON file with the actual stock:
Copy for the fetch:
fetch('https://blox-fruits-api.onrender.com/api/bloxfruits/stock')
.then(response => response.json())
.then((data) => {
const jsonData = data
const jsonObj = JSON.parse(jsonData)
console.log(JSON.stingify(jsonObj, null, 2));
})
.catch((error) => {
console.error('Error fetching data:', error);
});
Or copy the url:
https://blox-fruits-api.onrender.com/api/bloxfruits/stock
Here is also an api for all the fruits:
fetch('https://blox-fruits-api.onrender.com/api/bloxfruits')
.then(response => response.json())
.then((data) => {
const jsonData = data
const jsonObj = JSON.parse(jsonData)
console.log(JSON.stingify(jsonObj, null, 2));
})
.catch((error) => {
console.error('Error fetching data:', error);
});
Or copy the url:
https://blox-fruits-api.onrender.com/api/bloxfruits