Answer the question
In order to leave comments, you need to log in
[[+content_image]]
How to select value by key from json array?
I'll ask a stupid question, but I really don't catch up with something.
There is a json file with such content
Up to this point, I had to work only with the entire array.[["EURUSD","25"],["GBPCAD","10"],["EURCAD","18"]]
$.getJSON('data_actm.json', function(resultpl) {
var dp=[], labp = [];
for(var item in resultpl){
labp.push(resultpl[item].slice(0,1).toString());
dp.push(resmin[item].slice(1,2).toString());
}
});
Answer the question
In order to leave comments, you need to log in
$.getJSON('data_actm.json', (result) => {
let dp = [],
labp = [];
$.each(result, (key, value) => {
labp.push(value[0]);
dp.push(value[1]);
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question