JSON to Scala Case Class Converter
Paste JSON, get Scala case classes — Option types, nested objects, arrays — copy or download as .scala
Options
You’re integrating a REST API in Scala and need case classes that match the JSON response. The response has nested objects, arrays, and nullable fields. Writing case classes by hand means mapping every field, deciding between Option[T] and required fields, and writing codec derivations — tedious for large payloads.
What This Tool Does
Paste JSON and get Scala case classes instantly. Each nested object becomes its own case class. Nullable fields use Option[T]. Array elements are merged into a single case class with consistent field types.
Everything runs in your browser. Your data never leaves your device.
Type Mapping
| JSON type | Scala type |
|---|---|
"hello" | String |
42 | Int |
3.14 | Double |
true | Boolean |
null | Option[Any] |
[{...}] | List[ClassName] |
{...} | case class |
When to Use This
- Play Framework APIs — generate case classes with
Json.formatfor automatic JSON serialization - Akka HTTP / http4s — create request/response models from API documentation
- Spark data processing — define typed schemas from sample JSON records
- Circe integration — case classes work directly with Circe’s automatic codec derivation
FAQ
Does this send my data to a server?
No. All processing runs entirely in your browser.
How are nested objects handled?
Each nested JSON object becomes its own named case class. Names are derived from the parent class name plus the field key in PascalCase.