convert js objects to SQL queries