var obj = { s_campo1 : "'hola'", //string f_campo2 : 'now()', //function b_campo3 : true, //booleano i_campo4 : 5 //int } var query = "INSERT INTO TABLA (" + _.keys(obj).join(",") + ") " ; query += "VALUES "; query += "("+ _.values(obj).join(",") + ")" ; console.log(query)
test rck:
http://jsfiddle.net/yAFgu/7/