i'm right now working with a cocktail API and fetch data out of json. My question is:
Is there a way to rename a json key for example it's original is "strIngredient1" and I want it to be just "strIngredient", so that I can count up to the last key with the same name but changing last number. My idea was to include all objects into one string without doing "ingr1" + "ingr2" + "ingr3" and so on:
var x = 1;
var ingr = data.drinks[0].strIngredient+x;
var ListIngr = "";
do{
x++;
ListIngr.innerHTML =+ ${ingr}
while(ingr != null);
I already searched a lot, but couldn't really find anything.I'm still new to working with Json.