예제 #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);
        }
예제 #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);
     }
 }
예제 #3
0
        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);
            }
        }
예제 #4
0
 internal override void ConfigureJsonTypeInfo(JsonTypeInfo jsonTypeInfo, JsonSerializerOptions options)
 {
     jsonTypeInfo.CreateObjectForExtensionDataProperty = () => new JsonObject(options.GetNodeOptions());
 }
예제 #5
0
 internal override object CreateObject(JsonSerializerOptions options)
 {
     return new JsonObject(options.GetNodeOptions());
 }