sciss / serial

A simple serialization layer for the Scala programming language. Mirror of

Contributors Wanted


Build Status Maven Central


Serial provides a simple serialization layer for the Scala programming language. It is based on readers and writers of byte array or file backed up data streams.

Serial is (C)opyright 2011–2018 by Hanns Holger Rutz. All rights reserved. It is released under the GNU Lesser General Public License and comes with absolutely no warranties. To contact the author, send an email to contact at

requirements / installation

The project builds with sbt against Scala 2.12, 2.11.


The following dependency is necessary:

"de.sciss" %% "serial" % v

The current version v is "1.1.1".


import de.sciss.serial._

case class Person(name: String, age: Int)

implicit object PersonSerializer extends ImmutableSerializer[Person] {
  def write(v: Person, out: DataOutput) {

  def read(in: DataInput): Person = {
    val name  = in.readUTF()
    val age   = in.readInt()
    Person(name, age)

val p   = Person("Nelson", 94)
val out = DataOutput()
val ser = implicitly[ImmutableSerializer[Person]]
ser.write(p, out)
val bin = out.toByteArray

val in  = DataInput(bin)
val q   =
assert(p == q)

There are serializers included for the standard primitive types and common extensions such as Option, Either, Tuple2, List etc.