private static string SerializeObject(object value)
        {
            if (value == null)
            {
                return(null);
            }
            var type           = typeof(IJsonSerializer <>).MakeGenericType(value.GetType());
            var jsonSerializer = ServiceLocator.Current?.GetAllInstances(type).FirstOrDefault() as IJsonSerializer;

            return(jsonSerializer == null
                ? DefaultJsonSerializer.SerializeObject(value, Formatting.Indented)
                : jsonSerializer.SerializeObject(value, Formatting.Indented));
        }
Пример #2
0
        public static string SerializeObject(object request, Formatting formatting)
        {
            var serializer = new DefaultJsonSerializer();

            return(((IJsonSerializer)serializer).SerializeObject(request, formatting));
        }