Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

135
Vistas
Is there any way to change a json selected key value by a button click?

I have this json example, that i show it to the user in the GUI with textarea. is there any way with a button click for example to change only the third key value for example to "fourth value" without changing the whole json? maybe is there a way to dynamucally build the json when reading it from file to the textaera in a way that it will be easy to acceess any key and change it's value?

{
    "first_key": "firs_value",
    "second_key": "second_value",
    "third_key": "third_value",    
    "tests": 
    [
        { 
            "object_1_a": "a",
            "object_1_b": "b"
            },
            { 
            "object_2_a": "a",
            "object_2_b": "b"
            }
    ]
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Here's an example how to access and change the value of third_key:

const json = {
    "first_key": "firs_value",
    "second_key": "second_value",
    "third_key": "third_value",    
    "tests": 
    [
        { 
            "object_1_a": "a",
            "object_1_b": "b"
            },
            { 
            "object_2_a": "a",
            "object_2_b": "b"
            }
    ]
}

console.log('before', json)

json['third_key'] = 'changed';

console.log('after', json)

about 4 years ago · Juan Pablo Isaza Denunciar
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 Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda