public static string ConvertToJson(object obj, bool camelCase = false, bool indented = false)
{
var options = new JsonSerializerSettings();
if (camelCase)
{
options.ContractResolver = new CamelCasePropertyNamesContractResolver();
}
if (indented)
{
options.Formatting = Formatting.Indented;
}
return JsonConvert.SerializeObject(obj, options);
}
}