Generate C# classes from JSON
JetBrains Rider lets you generate C# classes based on existing JSON. For example, from the following JSON object:
JetBrains Rider will create classes that describe the structure of this object, which you can then use to read JSON files with the same object structure.
Copy a valid JSON to the clipboard — this can be the whole text of a JSON file or one or more objects in the JSON format. If you copy a part of JSON file, make sure that the copy is a valid JSON that starts and ends with
{...}or[...]on the same level.Place the caret in a C# file where class declarations are allowed.
Press Ctrl+Shift+A or choose from the main menu. In the popup that opens, start typing
Paste Special: JSON as Classes, select the corresponding item and press Enter.