JS traverses the key value pairs in the Json string by first converting them to Json objects and then iterating over them


1. Convert a Json string into a Json object

var t='{"firstName": "cyra", "lastName": "richardson"}';
var obj = eval('(' + t + ')');

2. Read through the key-value pairs

for(var str in obj){
alert(str+'='+obj[str]);
}