Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

NullToEmptyStringResolver.cs

using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace Nop.Plugin.Shipping.UPS.API;

public class NullToEmptyStringResolver : DefaultContractResolver
{
    protected override IList CreateProperties(Type type, MemberSerialization memberSerialization)
    {
        return type.GetProperties()
            .Select(p => {
                var jp = base.CreateProperty(p, memberSerialization);
                jp.ValueProvider = new NullToEmptyStringValueProvider(p);
                return jp;
            }).ToList();
    }
}