Class to JSON

Free. No sign-up. Your input is processed in your browser.

Paste a data class and get a sample payload.

How to use it

  1. Paste your class, and any classes it uses.
  2. Choose JSON or XML.
  3. If the wrong type is shown, enter the right name in Start from.

What is understood

Properties and fields, nested and inherited types, lists, dictionaries, enums, C# and Java records, Kotlin data classes, and TypeScript interfaces and types. Common rename and ignore attributes are used. In C#, non-public members are left out unless an attribute includes them.

Limits

This reads source text with simple rules. It is not a compiler. Complex generics, conditional code, custom converters and naming policies are not applied. A type you do not paste is shown as null. The XML is a plain element layout and may differ from what a .NET or Java XML serializer produces.

Questions

Are the values real?

No. They are placeholders such as "string" and 0.

How do I get camelCase names?

Tick camelCase names. Names set by an attribute stay as written.

Related tools

See all tools