OneTool

JSON to C# Converter

Turn sample JSON into C# model classes with inferred types.

What is this tool?

This converter inspects a JSON value and emits C# class definitions with properties mapped from object keys. Nested objects become separate classes and arrays become List<T>. A key that collides with a C# reserved word (e.g. "class") gets an @ prefix (@class) — the idiomatic C# escape — with a [JsonPropertyName] attribute added so it still (de)serializes to the original key. An array mixing primitive types (e.g. [10, "A+", 9.5]) is represented as List<object?> — C# has no clean idiomatic union-type equivalent for a generated POCO property, unlike the TypeScript and Python converters, which render a real union type for this case. Use it to bootstrap DTOs from API responses.

How to use it

  1. Paste JSON that represents the shape you want modeled.
  2. Toggle Preserve original property casing if you do not want PascalCase.
  3. Copy the generated classes into your .NET project (add System.Text.Json attributes as needed).