Hi I have a json response that I have to parse. I want to pull the data and insert it into inputs value (if it exists)
My json is like this:
{"id":4,"comb_name":"Monitor__C9cGTqnM7Trz","resolution":null,"attribute_val":3,"porte":4, "deleted_at":null,"created_at":"2017-11-13 10:10:25","updated_at":"2017-11-13 10:10:25"}
The code:
if(isset(jsobj)) {
var parsed = JSON.parse(jsobj);
console.log(parsed);
for (var property in parsed) {
if(parsed.hasOwnProperty(property)) {
var possible_input = '#pro_' + property;
if($(possible_input).length) {
var actual_input = $(possible_input);
actual_input.val(property);
}
}
}
}
It actually works, the only problem is that "property" are "attribute_val", not "3". What can I do to grab the value of the property?