简体   繁体   中英

Find the value in the key in json object

I stored the jsonvalue in one variable.

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

How to I get the result Testing(A,B) based on OnChange Key.

Am new of this field

As your variable result is an array you can access value using index.

var data = result[0].onChange;

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM