I have the following JSON
"values": [
["Martes", "pan", [8, [4],[0]], 7.381498329613434]
]
}
What would be the way to show the value: 7.381498329613434 in my Javascript console?
Thank you very much
I have the following JSON
"values": [
["Martes", "pan", [8, [4],[0]], 7.381498329613434]
]
}
What would be the way to show the value: 7.381498329613434 in my Javascript console?
Thank you very much
To access this value you must first access the object that contains it in this case values
data={"values": [
["Martes", "pan", [8, [4],[0]], 7.381498329613434]
]
}
values = data.values;
arr_values = values[0]
console.log(arr_values[3]);
As you can set I assign to a variable called values the object that contains my desired value.
With this assignment I get an array:
To obtain the desired value, I only address the desired position in this case 3
arr_values[3]
and there you would have your result:
I hope it will help you and help you! !!
You can do it like this:
var obj = {"values": [
["Martes", "pan", [8, [4],[0]], 7.381498329613434]
]
}
console.log(obj.values[0][3]);