0

I receive a JSON object from a web service. I can successfully deserialize this object with Json.net. But when I want to send this object with my WCF service using data contract serializer, I get a

System.Runtime.Serialization.InvalidDataContractException Type 'Newtonsoft.Json.Linq.JToken' is a recursive collection data contract which is not supported. Consider modifying the definition of collection 'Newtonsoft.Json.Linq.JToken' to remove references to itself.

If I create a clone of this object then I can send it out. But why not with the deserialized Json.net object?

Best Regards

1 Answer 1

0

WCF doesn't use JavascriptSerializer. It uses DataContractJsonSerializer. Replace it with Json.NET by writing a custom message formatter.

Check out this link

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.