Skip to content

Instantly share code, notes, and snippets.

@akunzai
Created January 8, 2014 07:39
Show Gist options
  • Save akunzai/8313166 to your computer and use it in GitHub Desktop.
Save akunzai/8313166 to your computer and use it in GitHub Desktop.
OrderedContractResolver
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
public class OrderedContractResolver : DefaultContractResolver {
protected override System.Collections.Generic.IList<JsonProperty> CreateProperties(System.Type type, MemberSerialization memberSerialization) {
return base.CreateProperties(type, memberSerialization).OrderBy(p => p.PropertyName).ToList();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment