Issues with serializing JSON response from REST

You might get the following message when trying to serialize a JSON response from a REST service with DataContractJsonSerializer :

End element 'XXX' from namespace 'XXX' is expected. Found element 'XXX' from namespace 'XXX'

If your message looks similar to this example you should check your data contract classes. It’s possible that some property has an invalid type association. For example, the REST service could return complex type Person with nested properties when the destination property in your data contract could declare simple class String.

Tags: ,

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Post

%d bloggers like this: