loot.tools

JSON to C#

Paste a JSON object or array and get C# classes back. Nested objects become their own classes, arrays become typed List<T>, and keys missing from some records become nullable. Add System.Text.Json or Newtonsoft (JSON.NET) property attributes, or leave them off.

Paste JSON to generate C# classes with auto-properties. Nested objects become their own classes, arrays become typed Lists, and keys missing from some records become nullable.

JSON Input
C# Output

What this tool does

Paste JSON and get ready-to-paste C# classes back. Each key becomes a PascalCase auto-property, nested objects turn into their own classes, and arrays become List<T> of the right element type. Pick System.Text.Json or Newtonsoft attributes if your JSON keys don't match C# naming, or skip them for plain properties.

Why you'd use this

Hand-writing model classes from an API response is tedious, and it's easy to miss a field or get a nested shape wrong. Drop the JSON here and get a matching class tree in seconds, then adjust the types instead of starting from scratch. Useful when you're consuming a new REST API, deserializing a config file, or building DTOs for a quick prototype.

How types are chosen

Whole numbers map to int (or long when they're too big for int), decimals to double, true/false to bool, and text to string. A value type becomes nullable (int?, double?, bool?) when the key is null in any sample or missing from some records. Mixed or null-only values fall back to object. JSON keys keep their casing as PascalCase property names, and the [JsonPropertyName] or [JsonProperty] attribute preserves the original key for serialization.