passing object correctly to js