javascript - How to get access to object's property? -


i have simple question access property of object. object inside quotes.

for example:

var obj = '{"prop1": 4, "prop2":3}'; obj.prop1 --> //undefined 

how can remove quotes?

obj string. convert object, use json.parse()

var str = '{"prop1": 4, "prop2":3}'; var obj = json.parse(str);  obj.prop1; // 4 

Comments