• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

92
Vistas
Modulating a json key

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.

JSON of the API

over 3 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda