1function getKeyValue(object) {
2 return Object.keys(object).reduce(function (result, key) {
3 return result.concat(
4 object[key] && typeof object[key] === 'object' ?
5 getKeyValue(object[key]) :
6 [[key, object[key]]]
7 );
8 }, []);
9}
10
11var data = { id: 23, name: "Jacob", link: { rel: "self", link: "www.abc.com", }, company: { data: { id: 1, ref: 324 } } };
12
13console.log(getKeyValue(data));