$.getJSON('contacts.json', function (json) {
var array = [];
for (var key in json) {
if (json.hasOwnProperty(key)) {
var item = json[key];
array.push({
name: item.Name,
surname: item.Surname,
mobile: item.mobile,
email: item.email
});
}
}
});
var j = {a:"aaaaaa", b:"bbbbbb", c:"cccccc"}
console.log(Object.keys(j))
const responseTypes = {
json: 'application/json',
text: 'text/*',
formData: 'multipart/form-data',
arrayBuffer: '*/*',
blob: '*/*'
};
console.log(Object.entries(responseTypes));
/*[each of the json key value becomes an array ]*/
function list() {
return Array.prototype.slice.call(arguments)
}
let list1 = list({0:"zero"}, {1:"one"}, {2:"two"}) //[ { '0': 'zero' }, { '1': 'one' }, { '2': 'two' } ]
console.log(list1);
let list2 = list({0:{z:"zero"}, 1:{o:"one"}});
console.log(list2) //[ { '0': { z: 'zero' }, '1': { o: 'one' } } ]