devxlogo

Converting JSON Results in Camel Case

Converting JSON Results in Camel Case

Use the CamelCasePropertyNamesContractResolver class of the Newtonsoft.Json assembly to return the JSON serialized string in camel case.

var responseObject = employeeProxy.GetAllEmployees();var serializedObjectInCamelCase = JsonConvert.SerializeObject(responseObject,      new JsonSerializerSettings     {        ContractResolver = new CamelCasePropertyNamesContractResolver()     });

devx-admin

Share the Post: