Let me explain this question with an example. If I have a JSON like the following:
{"person1":{"name": "Name One",
"address": {"street": "Some
Street","city": "Some City"}},
"person2":{"name": "Name Two",
"address": {"street": "Some Other
Street","city": "Some Other City"}}}
[There is no restriction on the number of persons, the input JSON can have many more persons]
I could extract this JSON to Persons object by doing
var persons = parse(res).extract[T]
Here are the related case classes:
case class Address(street: String,
city: String)
case class Person(name:
String, address: Address, children:
List[Child])
case class
Persons(person1: Person, person2:
Person)
Question: The above scenario works perfectly fine. However the need is that the keys are dynamic in the key/value pairs. So in the example JSON provided, person1 and person2 could be anything, I need to read them dynamically. What's the best possible structure for Persons class to account for that dynamic nature.