diff --git a/src/main/boilerplate/spray/json/ProductFormatsInstances.scala.template b/src/main/boilerplate/spray/json/ProductFormatsInstances.scala.template index fa0d875f..56674a2a 100644 --- a/src/main/boilerplate/spray/json/ProductFormatsInstances.scala.template +++ b/src/main/boilerplate/spray/json/ProductFormatsInstances.scala.template @@ -27,11 +27,11 @@ trait ProductFormatsInstances { self: ProductFormats with StandardFormats => } def jsonFormat[[#P1 :JF#], T <: Product](construct: ([#P1#]) => T, [#fieldName1: String#]): RootJsonFormat[T] = new RootJsonFormat[T]{ def write(p: T) = { - val fields = new collection.mutable.ListBuffer[(String, JsValue)] - fields.sizeHint(1 * 2) + val fields = collection.immutable.Map.newBuilder[String, JsValue] + fields.sizeHint(1) [#fields ++= productElement##2Field[P1](fieldName1, p, 0)# ] - JsObject(fields.toSeq: _*) + JsObject(fields.result()) } def read(value: JsValue) = { [#val p1V = fromField[P1](value, fieldName1)#