Generate SQL WHERE conditions from JSON