Discussion:
[Lift] Lift-JSON :: Root object can't yet be List or Map (needs a feature from Scala 2.8)
Ali
2010-04-17 18:07:40 UTC
Permalink
Hi All,
I am using the latest snapshot of the lift-json with scala 2.8b1. I
tried to simply deserialize an empty json list "[]" and I got the
following exception:

net.liftweb.json.MappingException: Root object can't yet be List or
Map (needs a feature from Scala 2.8)
at net.liftweb.json.Meta$.fail(Meta.scala:100)
at net.liftweb.json.Extraction$.extract0(Extraction.scala:167)
at net.liftweb.json.Extraction$.extract(Extraction.scala:40)
at net.liftweb.json.JsonAST$JValue.extract(JsonAST.scala:248)
at net.liftweb.json.Serialization$.read(Serialization.scala:50)


My code is:

Serialization.write(Serialization.read[List[Double]]("[]"))

I appreciate your comments,

Thanks,
-A
--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to liftweb-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to liftweb+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Joni Freeman
2010-04-18 07:42:13 UTC
Permalink
Hi,

It is not possible to serialize a List directly yet. Current
workaround is to wrap root List into a wrapper instance, for instance
case class ListHolder(xs: List[Foo]) and then serialize it. This
deficiency will be fixed when we move to Scala 2.8. New Scala version
has improved Manifest feature which gives a reflective access to type
parameters (Manifest.typeArguments).

Cheers Joni
Post by Ali
Hi All,
 I am using the latest snapshot of the lift-json with scala 2.8b1. I
tried to simply deserialize an empty json list "[]" and I got the
net.liftweb.json.MappingException: Root object can't yet be List or
Map (needs a feature from Scala 2.8)
        at net.liftweb.json.Meta$.fail(Meta.scala:100)
        at net.liftweb.json.Extraction$.extract0(Extraction.scala:167)
        at net.liftweb.json.Extraction$.extract(Extraction.scala:40)
        at net.liftweb.json.JsonAST$JValue.extract(JsonAST.scala:248)
        at net.liftweb.json.Serialization$.read(Serialization.scala:50)
Serialization.write(Serialization.read[List[Double]]("[]"))
I appreciate your comments,
Thanks,
-A
--
You received this message because you are subscribed to the Google Groups "Lift" group.
For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en.
--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to liftweb-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to liftweb+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Loading...