Controlling JSON Processing

Learn about controlling JSON processing, including options for field inclusion/exclusion, casing policies, case sensitivity policies, and whitespace formatting.

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.

Working with JSON serialization

Let’s see some in action:

Step 1: Use your preferred code editor to add a new Console App or console project named WorkingWithJson to the Chapter09 solution or workspace.

  • In Visual Studio Code, select WorkingWithJson as the active OmniSharp project.

Step 2: In the WorkingWithJson project, in Program.cs, delete the existing statements, import the main namespace for working with high-performance JSON, and then statically import the System.Environment and System.IO.Path types, as shown in the following code:

Get hands-on with 1400+ tech skills courses.