Scala Json with capabilities for Scala Object Serialization
Scala Java


sjson: Transparent JSON Serialization in Scala

sjson offers non intrusive serialization of Scala objects into JSON. You can use sjson to serialize built in types, the basic generic data types and any custom data type that you design. Two types of serialization are supported right now :-

  1. Reflection based that offers JSON serialization capabilities without any user intervention. You define your class, use some of the out-of-the-box annotations (if required) and invoke the serialization API
  2. Typeclass based, that defines a serialization protocol that needs to be implemented for custom data objects. For built-in types, the default protocol implementation comes out of the box. This is very much a work in progress and will evolve with time. The current implementation, however is fairly robust though not yet fully complete.

For more details of the implementation and sample examples, have a look at the wiki.


2011/09/01: sjson 0.15 released

  • fixed #37: Problem in typeclass based serialization using Seq
  • builds in Scala 2.9.1

2011/08/29: sjson 0.14 released

  • fixed a bug with serializing a combo of List, Map and Option
  • fixed #35: Need to distinguish between cases where we have a List of objects or a List of Maps
  • fixed #34: Bug in serializing structures where the OptionTypeHint is for a nested value
  • fixed #33: Bug in serializing composite structures like a List within a Map
  • fixed issue #32: Serializing case objects (singleton objects) using sjson
  • fixed #30: SJSON.toJSON() should handle primitive arrays
  • fixed issue #26: optionally remove empty objects & arrays from result
  • fixed #29 (

2011/07/11: sjson 0.13 released

  • Bug fixes in reflection based API
  • Now compiles with scala 2.9.0-1
  • A few minor enhancements in typeclass based serialization

2011/05/16: sjson 0.12 released

  • Major improvements in reflection based API
  • De-serialization is more type-safe now – no need to cast
  • Improved deep serialization of generic structures in reflection based APIs
  • Improved test cases

2011/03/26: sjson 0.10 released

  • bug fixes in serialization of Enumerations and Options
  • builds with Scala 2.8.1 and Scala 2.9.0.RC1
  • refactoring of code
  • dependency on scalaz removed and moved to separate project sjson-scalaz

2010/09/16: sjson 0.8 released

  • type class based JSON serialization enhanced
  • fixed bug in reflection based serialization

2010/07/28: sjson 0.7 released


This software is licensed under the Apache 2 license, quoted below.

Licensed under the Apache License, Version 2.0 (the “License”); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.