JSON to C# Model Online — Free Tool

Automatically generate C# POCO classes and data models from standard JSON objects.

Privacy note: All processing happens entirely in your browser. No data is sent to our servers.

About this tool

The JSON to C# Model generator converts any valid JSON object into ready-to-use C# POCO classes (Plain Old CLR Objects). Paste your JSON and it instantly outputs a complete C# class structure with correct property types inferred from the JSON values — int, string, bool, List<T>, and nested classes.

Generated classes work with both System.Text.Json (JsonSerializer.Deserialize<Root>(json)) and Newtonsoft.Json (JsonConvert.DeserializeObject<Root>(json)). The root class is named 'Root' by default — rename it in your IDE to match your domain model.

Common use cases

  • Generating model classes for JSON API responses
  • Creating DTOs for ASP.NET Core controllers
  • Scaffolding deserialization models from Postman responses
  • Converting third-party API payloads into typed C# objects
  • Setting up strongly-typed models during API integration

How to use

  1. Paste your JSON object or array into the input panel.
  2. C# POCO classes are generated instantly in the output panel.
  3. Copy the output and paste it directly into your C# project.
  4. Rename the root class from 'Root' to match your domain (e.g. UserResponse, OrderDto).

This page is available at /tools/json-to-csharp-model/.

Related keywords

  • json to c# model
  • json to csharp
  • json to c# class
  • generate c# class from json
  • json to model c#
  • c# poco from json
  • deserialize json c#

FAQ

What is a POCO class in C#?

POCO stands for Plain Old CLR Object — a simple C# class with properties and no base class dependencies. POCOs are the standard way to map JSON responses to typed objects in .NET.

Does this work with System.Text.Json and Newtonsoft.Json?

Yes. System.Text.Json uses JsonSerializer.Deserialize<T>() and Newtonsoft.Json uses JsonConvert.DeserializeObject<T>(). Both work with the generated classes.

How does it handle nested JSON objects?

Each nested object becomes a separate C# class. The parent class has a property referencing the nested class by type.

How does it handle JSON arrays?

Arrays become List<T> properties where T is inferred from the array item type. An array of objects generates a List<ChildClass>.

What if my JSON has null values?

Null values generate nullable types — string?, int?, bool? — following C# nullable reference type conventions.