protected override void OnReadEnumerable(JsonTokenType tokenType, ref ReadStack state, ref Utf8JsonReader reader) { if (Converter == null) { ThrowHelper.ThrowJsonException_DeserializeUnableToConvertValue(RuntimePropertyType, reader, state.JsonPath()); } if (state.Current.KeyName == null && (state.Current.IsProcessingDictionary || state.Current.IsProcessingIDictionaryConstructible)) { ThrowHelper.ThrowJsonException_DeserializeUnableToConvertValue(RuntimePropertyType, reader, state.JsonPath()); return; } // We need an initialized array in order to store the values. if (state.Current.IsProcessingEnumerable && state.Current.TempEnumerableValues == null && state.Current.ReturnValue == null) { ThrowHelper.ThrowJsonException_DeserializeUnableToConvertValue(RuntimePropertyType, reader, state.JsonPath()); return; } TConverter value = Converter.Read(ref reader, RuntimePropertyType, Options); JsonSerializer.ApplyValueToEnumerable(ref value, ref state, ref reader); }
protected override void OnRead(JsonTokenType tokenType, ref ReadStack state, ref Utf8JsonReader reader) { if (Converter == null) { ThrowHelper.ThrowJsonException_DeserializeUnableToConvertValue(RuntimePropertyType, reader, state.JsonPath()); } TConverter value = Converter.Read(ref reader, RuntimePropertyType, Options); if (state.Current.ReturnValue == null) { state.Current.ReturnValue = value; } else { Set(state.Current.ReturnValue, (TDeclaredProperty)value); } return; }