after asking this question I was trying to get the grips of all of this serialization stuff in web api 2 and I read this http://www.asp.net/web-api/overview/formats-and-mode
So I asume I'm using the Json.net serializer which is the defaulted one. Anyway I still can use the DataContract in a class and therefore only the properties decorated with DataMember attribute will be serialized. Are these two assumptions correct?
The Json.Net is the default you're right. DataMembers are supported by both serializers. Json.Net does not require them.
2 If I don't decorate a class with DataContract all of the properties will be serialized. This happen to both the Json.net and the DataContractJsonSerializer
The DataContractJsonSerializer is intended for use with WCF client applications where the serialized types are typically POCO classes with the DataContract attribute applied to them. No DataContract, no serialization. The mapping mechanism of WCF makes the sending and receiving very simple, but only if your platform is homogeneous. If you start mixing in different toolsets, your program might go sideways.
The JavaScriptSerializer can serialize any type, including anonymous types (one way), and does so in a more conformant way. You lose the "automagic" of WCF, but you gain more integration options.
3 If I change (as in the question I linked) the resolver the serializer still uses it, is it because it's the Json.net one or one thing is not related to another? because if I use this in the Global
Place your code in Global.asax and the DataContractJsonSerializer should be used. How do you know that the it is not picked up ?
4 In case I have a class that derives from another one and I decorate the parent one with DataContract it seems to me that I have to decorate the child one's properties with DataMember for serializing it.
Yes. If you use DataContractJsonSerializer.