Let me describe my problem a bit first.
I got to work on an Xamarin app that had to utilize our API. The API is exposed via WCF service on two endpoints and it is either tcp or basic http. Because of the limitations of Xamarin platform I ended up using HttpWebClient for which I had to turn my WCF service restful. This is where problems start to emerge.
I ahve defined another endpoint that I named "rest" and configured it to return JSON through property named DefaultOutgoingResponseFormat. This property takes no effect because I will always get response in form of a XML.
If I remove the XmlSerializerFormatAttribute my service will return me JSON but now I dont have XML. This is easily fixable by making another endpoint whose default return value will be XML but the problems now get even more interesting since some of my classes will not get serialized properly and I will explain this now.
There is an attribute called XmlIgnore that is placed on a property. If you have a propert called Name and another property called NameSpecified and if you place this attribute on NameSpecified than property Name will not be serialized in case property NameSpecified holds value of false. This is extremely useful because the XML that is sent is not crowded with useless information. We want to keep this which effectively means we want to keep XmlSerializerFormatAttribute but also be able to return JSON.
Is this possible?