Tarmil / FSharp.SystemTextJson

System.Text.Json extensions for F# types
MIT License
323 stars 44 forks source link

.NET 6: Implement JsonPropertyOrderAttribute on records #98

Closed Tarmil closed 2 years ago

Tarmil commented 2 years ago

For example:

type Name =
    { [<JsonPropertyOrder 2>]
      firstName: string
      [<JsonPropertyOrder 1>]
      lastName: string }
JsonSerializer.Serialize({ firstName = "John"; lastName = "Doe" }, options)

should serialize into

{"lastName":"Doe","firstName":"John"}

instead of the default

{"firstName":"John","lastName":"Doe"}