public string getAvailableTrucks(string chosenDate) { DateTime selecetdDate = DateTime.ParseExact(chosenDate, "dd/MM/yyyy", null); JavaScriptSerializer j = new JavaScriptSerializer(); Trucks t = new Trucks(); List <Trucks> trucksList = t.getAvailableTrucksList(selecetdDate); return(j.Serialize(trucksList)); }