Skip to content

Add support for JSON serialization with System.Text.Json #3

@thomaslevesque

Description

@thomaslevesque

Using System.Text.Json, we can serialize Option<T> values to this:

{
  "Value": 42,
  "IsSome": true,
  "IsNone": false
}

but not deserialize it (it returns Option<T>.None).

The library should provide be a converter.

The JSON format could be something like this:

// Some
{
  "Value": 42
}

// None
{}

Note: serialization with Newtonsoft.Json works as expected (with the IsSome/IsNone properties)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions