JSON ↔ C# Converter

JSON to C# converter and C# to JSON converter | 2-in-1 tool

Share on WhatsApp Back to Home Page

What is JSON to C# and C# to JSON Converter?

This is a free 2-in-1 online converter for .NET developers. You can convert JSON to C# classes (POCOs) and also generate sample JSON from a C# class. It saves time when you are working with API responses and need matching models.

How to Use?

  • JSON to C#: Paste your JSON on the left side, enter class name, and click JSON → C# button. You will get ready-to-use C# classes with List, nullable types.
  • C# to JSON: Paste your C# class on the right side and click C# → JSON button. You will get a sample JSON object with default values.

Key Features

  • 100% Client-Side & Private - No data sent to server
  • Supports nested objects, arrays, List<T>
  • Generates clean PascalCase properties
  • C# to JSON creates sample data with dummy values
  • Fast, Free & Unlimited

Example

JSON input: { "id": 1, "name": "Asha", "isActive": true, "tags": ["dev", "admin"], "address": { "city": "Delhi", "pin": "110001" } }
C# output (typical): public class Address { public string City { get; set; } public string Pin { get; set; } } public class Root { public int Id { get; set; } public string Name { get; set; } public bool IsActive { get; set; } public List Tags { get; set; } public Address Address { get; set; } }

JSON to C# Type Mapping

JSON C# type
string string
whole number int
decimal number double
true / false bool
array List<T>
object nested class

Frequently Asked Questions (FAQ)

Q. Is my code safe? The conversion runs in your browser using JavaScript, and your input is not sent to our server.

Q. Why do property names change from camelCase to PascalCase? C# convention uses PascalCase for properties. Newtonsoft.Json matches names case-insensitively by default. With System.Text.Json, set PropertyNameCaseInsensitive = true or use the [JsonPropertyName] attribute.

Q. Does it support nested objects and arrays? Yes, nested objects become separate classes and arrays become List.

Q. Does C# to JSON support complex classes? It reads public properties such as string, int, bool and List and generates a sample JSON. For best results, use simple POCO classes.

Disclaimer: This tool is for developer use. Review the generated code and test it in your own project before using it in production.