Reputation: 1
I have a simple webapi hosted at UhuruCloud hosted at http://respro2013webapi.uhurucloud.com/api/values , which returns a array of strings
<ArrayOfstring xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<string>value1</string>
<string>value2</string>
</ArrayOfstring>
i am using this webapi in my windows phone application, when i use like
var books = JsonConvert.DeserializeObject<Details[]>(e.Result);
it gives exception error converting value "value1" to type
how can i display the results in a list in win phone app
Upvotes: 0
Views: 1975
Reputation: 129827
Your server appears to be returning XML, and you are trying to parse the XML using a JSON parser, which won't work. Since you said you are using Web API on the server, I think all you need to do to solve this problem is tell the server you want JSON back, not XML. (Web API can output either format.) In your client code, just add an Accept
header to your request with a value of application/json
.
Upvotes: 1