I am trying to convert this object to json string but the result is not returning the object for address.
here's the code
{
name: $('[name="name"]').val(),
age: $('[name="age"]').val(),
sex: $('[name="sex"]').val(),
birthday: $('[name="birthday"]').val(),
about: $('[name="about"]').val(),
addresses: mapAlfredObject(getAlfredObject('addresses')),
contacts: mapAlfredObject(getAlfredObject('contacts')),
};
here's how I implemented the mapAlfredObject method
function mapAlfredObject(obj) {
var items = [];
for (var index in obj) {
items[obj[index]['name']] = {
value: obj[index]['value'],
type: obj[index]['type'],
comment: obj[index]['comment']
};
}
return items;
}
here's the log from console
and the output from JSON.stringify
{"name":"","age":"","sex":"","birthday":"any","about":"","addresses":[],"contacts":[]}