I would suggest that you look at
[
wikipedia JSONP]
Your sample code does not seem to support your issue
(could you supply more details about your controller? you seem to be switching between customer/supplier)
I have tried the following :
Newton soft serialiser:
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
var Customer = new List<AutoCompleteModel>
{
new AutoCompleteModel { Name = "test1", SId = "1" },
new AutoCompleteModel { Name = "test2", SId = "2" },
new AutoCompleteModel { Name = "test3", SId = "3" },
};
var response = JsonConvert.SerializeObject(Customer);
}
}
public class AutoCompleteModel
{
public string SId { get; set; }
public string Name { get; set; }
}
This produced a message in the following form - which I think you need:
[{"SId":"1","Name":"test1"},{"SId":"2","Name":"test2"},{"SId":"3","Name":"test3"}]
I have repeated the same for an MVC controller and a Web Api controller:
public IHttpActionResult GetProducts(ODataQueryOptions<Product> queryOptions)
{
try
{
queryOptions.Validate(ValidationSettings);
}
catch (ODataException ex)
{
return this.BadRequest(ex.Message);
}
var settings = new ODataQuerySettings();
var results = queryOptions.ApplyTo(this.context.AsQueryable(), settings) as IEnumerable<Product>;
return this.Json(results);
}
This also created the message in the same format (albeit a different model)
[{"ID":1,"Description":"Orange","SalePrice":15.0,"ProductGroup":"Fruit"},{"ID":2,"Description":"Apple","SalePrice":5.0,"ProductGroup":"Fruit"},{"ID":3,"Description":"Pear","SalePrice":12.0,"ProductGroup":"Fruit"}]