Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using Newtonsoft.Json;
- using Newtonsoft.Json.Serialization;
- public static class JsonExtensionMethods
- {
- public static String ToJson(this object model)
- {
- JsonSerializerSettings settings = new JsonSerializerSettings
- {
- NullValueHandling = NullValueHandling.Ignore,
- ContractResolver = new CamelCasePropertyNamesContractResolver(),
- };
- return JsonConvert.SerializeObject(model, Formatting.Indented, settings);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement