Exemple #1
0
        public static FieldConverter ExcludeChangedTypes(IJsonSerializer jsonSerializer)
        {
            return((data, field) =>
            {
                foreach (var value in data.Values)
                {
                    if (value.Type == JsonValueType.Null)
                    {
                        continue;
                    }

                    try
                    {
                        if (!JsonValueValidator.IsValid(field, value, jsonSerializer))
                        {
                            return null;
                        }
                    }
                    catch
                    {
                        return null;
                    }
                }

                return data;
            });
        }
Exemple #2
0
        public static ValueConverter ExcludeChangedTypes(IJsonSerializer jsonSerializer)
        {
            return((value, field, parent) =>
            {
                if (value.Type == JsonValueType.Null)
                {
                    return value;
                }

                try
                {
                    if (!JsonValueValidator.IsValid(field, value, jsonSerializer))
                    {
                        return null;
                    }
                }
                catch
                {
                    return null;
                }

                return value;
            });
        }