Scala/Lift: How to parse json to a case class?

80 views Asked by At

We query an api with a list of items. Their response comes back giving status for each item like this:

{"Results":[
  {"item1":{"status": "whatever1", "cid":"blah1"}},
  {"item2":{"status": "whatever2", "cid":"blah2"}}
]}

item1 and item2 are ids that we use to query. I need to extract a simple list of class class Item(itemId: String, status: String, cid: String).

How do I do this?

We use Lift json which allows to convert to case classes if the fields are known, but in this case the fields are item ids themselves, so I am a little lost.

Thank you.

0

There are 0 answers