{
  "id": 8807530,
  "title": "C# basic JsonConverter tip",
  "url": "https://urgent.news/2026/09/21/c-basic-jsonconverter-tip",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-21T00:35:28.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/karenpayneoregon/c-basic-jsonconverter-tip-543k"
  },
  "original_language": "en",
  "account": "Using a JsonConverter in C# can simplify the process of converting data formats, such as importing data from a JSON file into a database. Proper planning of the data for a specific task, like ensuring proper formatting, is crucial. In this example, a simple JsonConverter is used to read and convert the JSON string value, capitalizing the first character of a string.\n\nThe provided JsonConverter, named `UpperCaseFirstCharConverter`, inherits from `JsonConverter` and implements three methods: `CanConvert`, `Read`, and `Write`. The `CanConvert` method checks if the desired type to convert is a string. The `Read` method reads the JSON string value, sets it to an empty string if null, and capitalizes the first character using the `CapitalizeFirstLetter()` method. The `Write` method writes the string value to the JSON output.\n\nTo use the converter, include it in the `GlobalJsonOptions` with other converters and set `WriteIndented` to true for proper formatting. In the example usage, a list of `Person` objects is defined with sample data, including names in lowercase. The `JsonSerializer` is then used to deserialize the JSON data into a list of `Person` objects, and the list is serialized back into JSON format using the `UpperCaseFirstCharConverter`. This results in a proper-cased JSON output, with the first character of the `FirstName` and `LastName` properties capitalized.",
  "summary": "Introduction Learn how to properly use a JsonConverter, along with property and global setup for converters. Before getting started, the converter is intentionally simple. The focus here is proper planning for the data for a specific task, like importing data from a JSON file into a database, in this case, properly formatted. Sample converter Reads and converts the JSON string value to ensure the…",
  "key_points": [
    "UpperCaseFirstCharConverter is a custom JsonConverter in C#",
    "Capitalizes first character of string during JSON conversion",
    "Improves data formatting for specific tasks"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}