Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

JsonConvert.DeserializeObject options camelcasing c# .net

var jo = new JObject();
jo["CamelCase"] = 1;

string json = JsonConvert.SerializeObject(jo);
var jObject = JsonConvert.DeserializeObject<ExpandoObject>(json);

var settings = new JsonSerializerSettings()
{
    ContractResolver = new CamelCasePropertyNamesContractResolver()
};

var serialized = JsonConvert.SerializeObject(jObject, settings);

Assert.AreEqual("{"camelCase":1}", serialized);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #options #camelcasing
ADD COMMENT
Topic
Name
9+8 =