JSON... deserializing lists of parameterized case classes

8 views
Skip to first unread message

David Pollak

unread,
Oct 15, 2009, 6:11:28 PM10/15/09
to liftweb
Howdy,

I've got something like:

final case class Foo[T](name: String)

final case class ManyFoos(who: List[Foo[_]]))

If I do JSON serialization/deserialization using lift-json, of an instance of ManyFoos, the deserialization stuff throws an exception.  Is this expected or should I file a ticket?

Thanks,

David

--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

Joni Freeman

unread,
Oct 16, 2009, 3:16:03 AM10/16/09
to Lift
Hi David,

Please file a ticket, serialization does not support polymorphic Lists
yet. It requires that we add type information into JSON. Something
like:

{
"who": [
{
jsonClass = "example.Foo1"
...
},
{
jsonClass = "example.Foo2"
...
}
]
}

Cheers Joni


On Oct 16, 1:11 am, David Pollak <feeder.of.the.be...@gmail.com>
wrote:
> Howdy,
> I've got something like:
>
> final case class Foo[T](name: String)
>
> final case class ManyFoos(who: List[Foo[_]]))
>
> If I do JSON serialization/deserialization using lift-json, of an instance
> of ManyFoos, the deserialization stuff throws an exception.  Is this
> expected or should I file a ticket?
>
> Thanks,
>
> David
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890

David Pollak

unread,
Oct 16, 2009, 7:08:56 PM10/16/09
to lif...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages