Scala Class to JSON Schema Generator

Need JSON to Scala?

Convert JSON data to Scala code

JSON → Scala Case Classes

Scala code Input

Loading...

JSON Schema Output

Paste your Scala case classes to produce JSON Schema instantly.

Supports Option[T], collections, maps, nested case classes, and default values.

Frequently Asked Questions

What Scala types are supported?

The converter reads case classes and regular classes with constructor parameters. It handles Option[T], collections (List/Seq/Vector/Array/Set), maps, default values, and basic primitive types. Nested case classes are supported as long as they appear in the same snippet.

How does type inference work?

Primitive types (String, Int, Long, Double, Boolean, BigDecimal, Instant, UUID, etc.) map to JSON Schema primitives with formats. Collections become arrays, maps become objects, and Option[T] marks fields as optional. Unknown types fall back to strings unless another case class with that name exists.

Does it support Scala 3 and older syntax?

Yes. As long as the class definition follows the standard case class syntax, the tool will parse it. The conversion happens entirely in your browser, so your source code remains private.

How can I create mock JSON data?

After generating the schema, click "Generate Mock Data" to open the Mock Generator with the schema preloaded. Configure locales, array sizes, and optional fields to create sample payloads instantly.