Exemple #1
0
        public override JsonValue Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            JsonElement element = JsonElement.ParseValue(ref reader);
            JsonValue   value   = new JsonValue <JsonElement>(element, options.GetNodeOptions());

            return(value);
        }
Exemple #2
0
 public override JsonObject? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
 {
     switch (reader.TokenType)
     {
         case JsonTokenType.StartObject:
             return ReadObject(ref reader, options.GetNodeOptions());
         default:
             Debug.Assert(false);
             throw ThrowHelper.GetInvalidOperationException_ExpectedObject(reader.TokenType);
     }
 }
        public override JsonArray?Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        {
            switch (reader.TokenType)
            {
            case JsonTokenType.StartArray:
                return(ReadList(ref reader, options.GetNodeOptions()));

            case JsonTokenType.Null:
                return(null);

            default:
                Debug.Assert(false);
                throw ThrowHelper.GetInvalidOperationException_ExpectedArray(reader.TokenType);
            }
        }
Exemple #4
0
 internal override void ConfigureJsonTypeInfo(JsonTypeInfo jsonTypeInfo, JsonSerializerOptions options)
 {
     jsonTypeInfo.CreateObjectForExtensionDataProperty = () => new JsonObject(options.GetNodeOptions());
 }
Exemple #5
0
 internal override object CreateObject(JsonSerializerOptions options)
 {
     return new JsonObject(options.GetNodeOptions());
 }