Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

142
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda