Skip to content
 
 

Latest commit

 

History

604 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Newtonsoft.Json

Json.NET is a popular high-performance JSON framework for .NET

Add a convenience class to convert a Json token String or Array to IList. I needed because the Json I parsed is not always well-formed: sometimes is an array but if there's only on element, it's a string. An implementation of the class:

    internal class EventContractResolver : DefaultContractResolver
    {
        internal static readonly EventContractResolver Instance = new EventContractResolver();

        protected override JsonProperty CreateProperty(System.Reflection.MemberInfo member, MemberSerialization memberSerialization)
        {
            JsonProperty property = base.CreateProperty(member, memberSerialization);

            if (property.DeclaringType.Equals(typeof(Tags)))
            {
                if(property.PropertyName == "tag") {
                    property.MemberConverter = new StringOrArrayToIListJsonConverter();
                }
            }
            return property;
        }
    }

About

Json.NET is a popular high-performance JSON framework for .NET

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages