if I want to de-serialize a received {"message":"some message", "type":"some type", "code":123} to
type SampleTarget = {Message: string; Type: string; code: int}, the mismatch of the case will stop me: The received keys are all lower cases, and the F# type needs to be Pascal Case.
Serialization case is similar.
(I take this example just because we cannot have type SampleTarget = {...; type: string})
I only found unionTagCaseInsensitive in documentation, which doesn't fit here.
It would be good if there is an option to help deal with such an issue. Any suggestions? Thanks!
Record fields use options from the JsonSerializerOptions. So you can use either JsonSerializerOptions(PropertyNameCaseInsensitive = true) or JsonSerializerOptions(PropertyNamingPolicy = JsonNamingPolicy.CamelCase)
if I want to de-serialize a received
{"message":"some message", "type":"some type", "code":123}
totype SampleTarget = {Message: string; Type: string; code: int}
, the mismatch of the case will stop me: The received keys are all lower cases, and the F# type needs to be Pascal Case.Serialization case is similar.
(I take this example just because we cannot have
type SampleTarget = {...; type: string}
)I only found
unionTagCaseInsensitive
in documentation, which doesn't fit here.It would be good if there is an option to help deal with such an issue. Any suggestions? Thanks!