Q: Return XML Data From Asp.Net API I have an asp.net API that is using returning xml data from my Server.  This is the format the data is returned in (what I get when I type localhost.... into my address bar)
ID = 3, fname = a, lname = a, phone = 123, company = abcID = 4, fname = a, lname = b, phone = c, company = dID = 5, fname = aa, lname = bb, phone = cc, company = ddID = 6, fname = Frame, lname = Blame, phone = 5555555555, company = Company

When I attempt to use my C# to return the data from the API I get this error

Error converting value "ID = 3, fname = a, lname = a, phone = 123, company = abc" to type 'TestData'

This is the method I am using to attempt to retrieve the data.  What must I do in order to have the data accurately returned?
        public List<TestData> GetGridInfo()
    {
        string URI = "http://localhost/api/getinfo";

        using (var webClient = new System.Net.WebClient())
        {
            var json = webClient.DownloadString(URI);

            var message = JsonConvert.DeserializeObject<List<TestData>>(json);

            return message;
        }
    }

This is API syntax ->
        public IEnumerable<string> Get()
    {
        List<string> result = new List<string>();
        using (XamarinEntities entities = new XamarinEntities())
        {
            result = entities.appinfoes.AsEnumerable().Where(x => x.approveduser == null || x.approveduser=="No").Select(y =>  "ID = "+y.ID+", fname = "+ y.fname+", lname = "+ y.lname+", phone = "+ y.phone+", company = "+ y.company).ToList();
        }
        return result;
    }

EDIT -> The above syntax is how it looks on my local machine, if I use the server to hit localhost this is the format I get which looks like XML to me...
<?xml version="1.0" encoding="ISO-8859-1"?>
<ArrayOfstring     xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays"     xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<string>ID = 3, fname = a, lname = a, phone = 123, company = abc</string>
<string>ID = 4, fname = a, lname = b, phone = c, company = d</string>
<string>ID = 5, fname = aa, lname = bb, phone = cc, company = dd</string>
</ArrayOfstring>


A: You are not returning JSON. you are returning an array of strings which is not JSON
you should do
public string Get()
{
    List<string> result = new List<string>();
    using (XamarinEntities entities = new XamarinEntities())
    {
        result = entities.appinfoes.AsEnumerable().Where(x => x.approveduser == null || x.approveduser=="No").Select(y =>  "ID = "+y.ID+", fname = "+ y.fname+", lname = "+ y.lname+", phone = "+ y.phone+", company = "+ y.company).ToList();
    }
    return JsonConvert.SerializeObject(result);
}

above code will return JSON instead of string array
Change your code to receive List
E.g
public List<string> GetGridInfo()
{
    string URI = "http://localhost/api/getinfo";

    using (var webClient = new System.Net.WebClient())
    {
        var json = webClient.DownloadString(URI);

        var message = JsonConvert.DeserializeObject<List<string>>(json);

        return message;
    }
}


A piece of advice use HttpClient instead of WebClient

