SystemTextJsonPatch icon indicating copy to clipboard operation
SystemTextJsonPatch copied to clipboard

JsonPatchDocument converter doesn't respect other converters added to JsonSerializerOptions

Open hell-racer opened this issue 1 year ago • 3 comments

Hi! We have string converter which trims string values and replaces empty strings with null. When JsonPatchDocumentConverter reads string values (specifically from value fields), it just uses val = reader.GetString(), so it ignores any string converters added to default JsonSerializerOptions. Is it possible to change value reading logic to just val = JsonSerializer.Deserialize<object>(ref reader); instead of this and this switch statements, to allow other converters to process values? Thanks!

hell-racer avatar Sep 04 '23 09:09 hell-racer

So, what do you think? :)

hell-racer avatar Nov 16 '23 12:11 hell-racer

We need to measure how much it affects the performance and make sure it does not create infinite loops, otherwise sounds good to me

Havunen avatar Nov 27 '23 11:11 Havunen

One possibility is to bring this feature in as a new option

Havunen avatar Nov 27 '23 11:11 Havunen