JSON to Scala Case Class

JSON → Scala 3 case classes. Int and Long are chosen by magnitude, nulls become Option[T], and reserved words are backtick-escaped.

JSON to Scala Case Class — Free Online Tool

Generates Scala 3 case classes from a JSON sample with Int, Long, Double, Boolean and String inference, Option[T] for nulls, List[T] for arrays and nested case classes for objects, plus an optional circe Decoder/Encoder derivation block, useful for modelling API payloads in Play, Akka HTTP and Spark jobs.

How to use the JSON to Scala Case Class

  • Open the tool above — it runs entirely in your browser, so your input never leaves this page.
  • Paste or type your input into the field, then press the relevant button (e.g. Encode / Decode, Generate, or Convert).
  • Copy the result from the output area with the copy button orCtrl/Cmd + C.
  • No signup, no upload, and no tracking — repeat as often as you need.

Frequently asked questions

Is the output Scala 2 or Scala 3?

Scala 3 syntax — the circe block uses `given` instances and indentation-based object bodies. The case classes themselves are valid in both; only the derivation block needs adjusting for Scala 2.

Why did a field become Long instead of Int?

Whole numbers larger than 2,147,483,647 do not fit in an Int. Epoch-millisecond timestamps and Snowflake IDs always exceed it, so they are typed Long to avoid a silent overflow.

Do I need circe to use the generated classes?

No. Turn the derivation off and you get plain case classes that work with Play JSON, jsoniter, uPickle or manual parsing. The circe option is there because semiauto derivation is the most common default.

Free & private — why use this JSON to Scala Case Class

The JSON to Scala Case Class runs 100% client-side in your browser. Your data is never uploaded to a server, no account is required, and the tool is completely free. It works offline once the page has loaded and is part of a growing collection of privacy-first developer utilities.

More json tools