Controlling JSON processing
There are many options for taking control of how JSON is processed, as shown in the following list:
- Including and excluding fields.
- Setting a casing policy.
- Selecting a case-sensitivity policy.
- Choosing between compact and prettified whitespace.
Let's see some in action:
- Use your preferred code editor to add a new console app named
WorkingWithJsonto theChapter09solution/workspace. - In Visual Studio Code, select
WorkingWithJsonas the active OmniSharp project. - In the
WorkingWithJsonproject, inProgram.cs, delete the existing code, import the two main namespaces for working with JSON, and then statically import theSystem.Console,System.Environment, andSystem.IO.Pathtypes, as shown in the following code:using System.Text.Json; // JsonSerializer using System.Text.Json.Serialization; // [JsonInclude] using static System.Console; using static System.Environment; using static System...