Class Rectangle

val rectWrites = (
  (__ \ 'width).write[Long] and
  (__ \ 'height).write[Long] and
  (__ \ 'x).write[Long] and
  (__ \ 'y).write[Long]
)( (r: Rectangle) => (r.width, r.height, r.x, r.y)  )