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"
}
]
}
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)