dotnet / dotnet/docs

Sample converter is broken

Open
#34,992 1 comment 0 reactions 1 assignee Claimed by @gewarren View on GitHub
:pushpin: seQUESTered dotnet-fundamentals/svc okr-quality
Dominant language
No language data
Stars
4.8k
Forks
6.1k
Avg merge
15h 21m
Merged PRs (30d)
370

Description

The Sample usage of the converter in this page has the serializeOptions setting Converters. I'm getting Converters is read only from VS 2022 v17.5.1.

var serializeOptions = new JsonSerializerOptions
{
WriteIndented = true,
**Converters =
{
new DateTimeOffsetJsonConverter()
}**
};

jsonString = JsonSerializer.Serialize(weatherForecast, serializeOptions);

---
#### Document Details

⚠ *Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.*

* ID: 5de37d79-751f-e372-e866-efde28f4908c
* Version Independent ID: 678c4f23-764a-7ccd-0d6d-159a30957477
* Content: [How to write custom converters for JSON serialization - .NET](https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/converters-how-to)
* Content Source: [docs/standard/serialization/system-text-json/converters-how-to.md](https://github.com/dotnet/docs/blob/main/docs/standard/serialization/system-text-json/converters-how-to.md)
* Product: **dotnet-fundamentals**
* GitHub Login: @gewarren
* Microsoft Alias: **gewarren**

---
[Associated WorkItem - 91666](https://dev.azure.com/msft-skilling/Content/_workitems/edit/91666)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.