private JsonProperty HandleJsonAttribute(MemberInfo member, JsonProperty jsonProperty)
        {
            var attributes = member.GetCustomAttributes(typeof(JsonCustomizationAttribute), inherit: true);
            JsonCustomizationAttribute jsonAttr = null;

            if (attributes != null && attributes.Length > 0)
            {
                jsonAttr = attributes[0] as JsonCustomizationAttribute;
            }

            return(HandleJsonAttribute(jsonAttr, jsonProperty));
        }
        private JsonProperty HandleJsonAttribute(JsonCustomizationAttribute jsonAttr, JsonProperty jsonProperty)
        {
            if (jsonAttr == null)
            {
                return(jsonProperty);
            }

            if (jsonAttr.IsIgnored)
            {
                jsonProperty.Ignored = true;
                return(jsonProperty);
            }

            // It has JsonCustomizationAttribute and not marked for "IsIgnored"
            jsonProperty.HasMemberAttribute = true;

            if (!string.IsNullOrWhiteSpace(jsonAttr.PropertyName))
            {
                jsonProperty.PropertyName = jsonAttr.PropertyName;
            }

            // Change json property's order of appearance
            int?order = jsonAttr.GetAppearanceOrder();

            if (order.HasValue)
            {
                jsonProperty.Order = order;
            }

            if (jsonAttr.ReCreateMember)
            {
                jsonProperty.ObjectCreationHandling = ObjectCreationHandling.Replace;
            }

            // Change json property's default value handling
            if (jsonAttr.IsDefaultValueIgnored)
            {
                jsonProperty.DefaultValueHandling = DefaultValueHandling.Ignore;
            }

            return(jsonProperty);
        }