c#,asp.net-web-api,json.net,camelcasing,datacontractjsonserialize
you can use ApiController.Json method. just return like this from your controller method return Json(data, new JsonSerializerSettings(){ContractResolver = new DefaultContractResolver()}); ...
c#,json,serialization,datacontractjsonserialize
Assuming you're just trying to write the text to a file, it's not clear why you're writing it to a MemoryStream first. You can just use: var js = new DataContractJsonSerializer(typeof(T), _knownTypes); using (var stream = File.Create(path)) { js.WriteObject(stream, item); } That's rather simpler, and should do what you want......
c#,.net,json,serialization,datacontractjsonserialize
Turns out it was just a simple thing of changing the encoding line to buffer = Encoding.UTF8.GetBytes(serializedString); ...
c#,json,rest,serialization,datacontractjsonserialize
Since none of your classes are actually polymorphic, there are a couple solutions available that use .Net built-in class libraries: Solution 1: JavaScriptSerializer Solution JavaScriptSerializer makes it easy to remap interfaces to classes during deserialization by using a JavaScriptConverter. However, it does not allow field and property names to be...