Home > Article > Web Front-end > JS traverses the key-value pairs in the Json string first into JSON objects and then traverses_javascript skills
1. Convert Json string into JSON object
var t='{"firstName": "cyra", "lastName": "richardson"}'; var obj = eval('(' + t + ')');
2. Traverse and read key-value pairs
for(var str in obj){ alert(str+'='+obj[str]); }