I
I
Ivan2015-08-10 20:56:40
ASP.NET
Ivan, 2015-08-10 20:56:40

How to replace default JSONSerializer with JSON.Net in WCF service?

Good afternoon!
Such a question: There is an external API that receives requests from partners and passes them to the internal one. Back respectively sends responses. Works using SOAP and REST - the internal API returns XML, which in the case of a rest call is re-serialized to JSON.
One of the calls to the internal API returns an object with one of its properties marked as IsReference=true. Google says this means that an object can contain properties - objects of the same class. The standard serializer on such an object dies, saying:

cannot be serialized to JSON because its IsReference setting is 'True'. The JSON format does not support references because there is no standardized format for representing references.

However, I know that JSON.Net handles such things by setting the ReferenceLoopHandling=Ignore parameter.
Attention, the question is: how to replace the serializer with JSON.Net? I found something here , but the information is from 2011, maybe something has changed since then or is there a simpler option?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mayorovp, 2015-08-11
@sputnic

Nothing has changed there. There is no easier option - simply because that option is already very simple.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question