I have object as var obj = [{"PRODUCT_ID":"P01","M01":1,"M02":2, "M03": null}] . I want to get key and value this sample
PRODUCT_ID is P01
M01 is 1
M02 is 2
M03 is null
I try with as follow
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
console.log(key + " is " + obj[key]);
}
}
It't not working , it's show wrong with format.
0 is [
1 is {
2 is "
3 is P
4 is R
5 is O
6 is D
...etc
I using javascript to this. If maybe can convert to json and show this .
objis string, Can you share the output oftypeof obj?