I am not able to get a key and value pairs using the each function of jquery. How to get the key and values object using jQuery each function..?
my try:
var result = '{"FirstName":"John","LastName":"Doe","Email":"[email protected]","Phone":"123 dead drive"}';
$.each($.parseJSON(result), function(n, v) {
console.log({n: v});
});
result i am getting as:
Object {n: "John"}
Object {n: "Doe"}
Object {n: "[email protected]"}
Object {n: "123 dead drive"}
but i am looking for :
Object {FirstName: "John"}
Object {LastName: "Doe"}
Object {Email: "[email protected]"}
Object {Phone: "123 dead drive"}
what is the correct approach to get this done..?
Thanks in advance.