在json对象中查找关键字中的值

Find the value in the key in json object

本文关键字:关键字 查找 对象 json      更新时间:2023-09-26

我将jsonvalue存储在一个变量中。

var result=[{"controlID":"B","currentValue":"5","onChange":"Testing(A,B)","onClick":""}];

如何基于OnChange密钥得到结果Testing(A,B)

我是这个领域的新手

由于变量result是一个数组,因此可以使用索引访问值。

var data = result[0].onChange;

var result=[{"controlID":"B","currentValue":"5","onChange":"Testing(A,B)","onClick":""}];
var data = result[0].onChange;
alert(data)