 <p>Here's a reasonably straightforward working example that produces the output you want:</p> <pre><code>import play.api.libs.json._ val json = Json.parse(""" {"1342558874663000":{"TEMPERATURE_C":"253","TEMPERATURE_F":"775"}, "1342558854606000" :{"TEMPERATURE_C":"254","TEMPERATURE_F":"776"}} """).as[JsObject] Json.toJson(json.fields.flatMap { case (epoch, obj) =&gt; obj.as[JsObject].fields.map(epoch -&gt; _) }.groupBy(_._2._1).mapValues( _.map { case (epoch, (_, v)) =&gt; Seq(epoch, v.as[String]) } )) </code></pre> <p>The trick here is to flatten the list and then rebuild the structure you need.</p>