0

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

2
  • i have a class named Details class Details { public string Title {get; set;} } thats why i used Details[] Commented Nov 29, 2013 at 13:02
  • 11
    Are you trying to deserialize XML using a JSON serializer ? It doesn't make sense... Commented Nov 29, 2013 at 13:06

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.