0

Here's my use case: I need to access to an Array in a JSON document and then iterate on it in order to apply JSON coast-to-coast transformation to each object and get a collection of the transformed object.

I was thinking about an approach like this:

def myTransformerFunc(json: JsValue): JsResult[JsObject] = {}

val results = (res.json \ "results")  // access to the the array
val transformedObjects = results.map( myTransformerFunc(_) )

But results is a JsLookupResult type and has no .map() method.

What do I need to do?

Max
  • 2,508
  • 3
  • 26
  • 44

1 Answers1

1

Here you go:

 val results = (res.json \ "results").as[String]
Rhys Bradbury
  • 1,699
  • 13
  • 24