]]>Comment Posted by dcowanhttp://asp.net/web-api/overview/formats-and-model-binding/json-and-xml-serializationTue, 26 Jun 2012 10:46:30 GMT00000000-0000-0000-0000000015855Just wanted to let you know there is an error in your last example

@nachof: If you use the [DataContract] attribute, you can set the namespace for the type.

[DataContract(Namespace="mynamespace")]

]]>Comment Posted by rrjphttp://asp.net/web-api/overview/formats-and-model-binding/json-and-xml-serializationWed, 27 Jun 2012 16:10:57 GMT00000000-0000-0000-0000000015870So, if I want to use [JsonIgnore] in my code, I need to download Json.NET from CodePlex and reference it from the Json.NET library?

Just want to make sure you aren't already exposing it through JsonMediaTypeFormatter somehow before I go and get it.

]]>Comment Posted by MikeWassonhttp://asp.net/web-api/overview/formats-and-model-binding/json-and-xml-serializationThu, 28 Jun 2012 18:31:26 GMT00000000-0000-0000-0000000015876@rrjp: As of RC, the JsonMediaTypeFormatter uses JSON.Net, so you shouldn't need to add JSON.Net.]]>Comment Posted by ognyandimhttp://asp.net/web-api/overview/formats-and-model-binding/json-and-xml-serializationTue, 10 Jul 2012 04:38:20 GMT00000000-0000-0000-0000000015948Very good explanation. The code is outdated and some of the properties and namespaces are not existent.]]>Comment Posted by MikeWassonhttp://asp.net/web-api/overview/formats-and-model-binding/json-and-xml-serializationThu, 12 Jul 2012 16:17:59 GMT00000000-0000-0000-0000000015965ognyandim: Which properties/namespaces? This topic *should* be up-to-date for the RC release, but it's possible I have some errors.]]>Comment Posted by daniel vaughanhttp://asp.net/web-api/overview/formats-and-model-binding/json-and-xml-serializationWed, 22 Aug 2012 10:48:34 GMT00000000-0000-0000-0000000016250Thanks for the section on Testing Object Serialization, Mike. Very useful.

I would remove the "Headers" from this line though: formatter.WriteToStreamAsync(typeof(T), value, stream, content.Headers, null).Wait();

]]>Comment Posted by ProcuraIsaachttp://asp.net/web-api/overview/formats-and-model-binding/json-and-xml-serializationThu, 13 Dec 2012 17:09:53 GMT00000000-0000-0000-0000000016997Is it possible to have the JSON.NET serializer look at the DataMember Name attribute like the XML serializer does?

"To change how a member name appears in the XML, set the Name parameter in the DataMember attribute"

This article helped me solve an empty 500 HttpStatusCode I was receiving from my Web API for no reason I could see. I landed on this from one of the comments on StackOverflow about circular references in the object graph (which I did have and which would be very common in Entity Framework generated model scenarios). I was pleasantly surprised to see that you are the writer of this article.

]]>Comment Posted by repshttp://asp.net/web-api/overview/formats-and-model-binding/json-and-xml-serializationMon, 22 Apr 2013 15:24:56 GMT00000000-0000-0000-0000000018959I would like to add that DateTime is NOT written in ISO 8601 format (both with JSON and XML serializers). It has no Z suffix. This is the output I get: "2013-04-21T22:10:56.65".

To have ISO 8601 format you should use DateTimeOffset data type.

Maybe it would be a good idea to add this information to this article.