public override object ReadJson()

in src/YouTrackSharp/Json/ProjectVersionConverter.cs [29:55]


        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            if (reader.TokenType == JsonToken.Null)
            {
                return null;
            }

            var collection = existingValue as ICollection<string>;

            // ReSharper disable once InvertIf
            if (reader.TokenType == JsonToken.String)
            {
                var value = (string)reader.Value;
                
                // ReSharper disable once InvertIf
                if (!string.IsNullOrEmpty(value))
                {
                    var splitEntries = value.Trim('[', ']').Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries);
                    foreach (var entry in splitEntries)
                    {
                        collection?.Add(entry.Trim());
                    }
                }
            }

            return collection;
        }