Skip to content

Commit af51440

Browse files
authored
Revise AI section (#49905)
1 parent ca2ed20 commit af51440

File tree

1 file changed

+7
-7
lines changed
  • docs/standard/serialization/system-text-json

1 file changed

+7
-7
lines changed

docs/standard/serialization/system-text-json/how-to.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "How to serialize JSON in C#"
33
description: "Learn how to use the System.Text.Json namespace to serialize to JSON in .NET. Includes sample code."
4-
ms.date: 02/11/2025
4+
ms.date: 11/20/2025
55
no-loc: [System.Text.Json, Newtonsoft.Json]
66
dev_langs:
77
- "csharp"
@@ -110,14 +110,14 @@ Starting in .NET 9, you can also customize the indent character and size using <
110110
111111
## Use AI to serialize to JSON
112112

113-
You can use AI tools, such as GitHub Copilot, to generate code that uses `System.Text.Json` to serialize to JSON. You can customize the prompt to use object fields that suit your requirements.
113+
You can use AI tools, such as GitHub Copilot, to generate code that uses `System.Text.Json` to serialize to JSON. You can customize the prompt to fit your object fields and serialization needs.
114114

115-
The following text shows an example prompt for Copilot Chat:
115+
Here's an example prompt you can use to generate serialization code:
116116

117117
```copilot-prompt
118-
Generate code to use System.Text.Json to serialize an object to a JSON string.
119-
The object contains the following fields: FirstName (string), Lastname (string), Age (int).
120-
Provide example output.
118+
I have a variable named weatherForecast of type WeatherForecast.
119+
Serialize the variable using System.Text.Json and write the result directly to a file named "output.json" with the JSON indented for pretty formatting.
120+
Ensure the code includes all necessary using directives and compiles without errors.
121121
```
122122

123123
Review Copilot's suggestions before applying them.
@@ -127,4 +127,4 @@ For more information about GitHub Copilot, see GitHub's [FAQs](https://github.co
127127
## See also
128128

129129
- [GitHub Copilot in Visual Studio](/visualstudio/ide/visual-studio-github-copilot-install-and-states)
130-
- [GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/overview)
130+
- [GitHub Copilot in Visual Studio Code](https://code.visualstudio.com/docs/copilot/overview)

0 commit comments

Comments
 (0)