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