Let's say we have a with some parameters:
case class Person
Now, I want to create a case class that contains a single element:
person: Person
(since things like Ember require that)
I also want to generate the case class
persons: Seq[Person]
Is there any way I can generate both of these?
Something that would have the signature along the lines of
generateListType[T](T, Seq[T])
where I could do
generateListType(Person, List(Person("test"), Person("test2"))
which then would create the JSON
{
"persons": [{"name": "person 1"}, {"name", "person 2"}]
}
Aucun commentaire:
Enregistrer un commentaire