[jQuery] How to print json data, key and value

[jQuery] How to print json data, key and value


Hi all,
from my PHP script with json_encode() I print this json output:
[{"name":"pippo","surname":"pluto","age":"20"}]
Is possible to print the key and the value of json object without using
code like this:
$.each(data, function(key, value){
console.log(value.name);
console.log(value.surname);
console.log(value.age);
});
but something like:
$.each(data, function(key, value){
console.log(key . '-' . value);
});
and achieve output like this:
name - pippo
surname - pluto
age - 20
--
Massimiliano Marini <max@linuxtime.it>