Exemplo n.º 1
0
        public override long Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            if (reader.TokenType == JsonTokenType.String)
            {
                if (!long.TryParse(reader.GetString(), out var res))
                {
                    throw new JsonException("Failed to parse json number");
                }

                return(res);
            }

            return(reader.GetInt64());
        }