Objects to table in JavaScript