Re: [Lift] Re: serializing and deserializing a json object through Lift-JSON

2010-02-20 Thread Ross Mellgren
http://www.assembla.com/spaces/liftweb/tickets/358 It's already been pushed to master so is probably in 2.0-SNAPSHOT. -Ross On Feb 20, 2010, at 5:09 AM, Ali wrote: > Hi Joni, > Would you please also post the ticket url so I can track it. > > Thank you again, > -A > > On Feb 20, 10:39 am, Joni

[Lift] Re: serializing and deserializing a json object through Lift-JSON

2010-02-20 Thread Ali
Thank you :) -A On Feb 20, 10:39 am, Joni Freeman wrote: > Ok, this was yet another bug in serialization code. It is now fixed > and should be in next snapshot build. Deserializing null values were > not supported. Note a recommended way is to use Option for optional > values. This would've wor

[Lift] Re: serializing and deserializing a json object through Lift-JSON

2010-02-20 Thread Ali
Hi Joni, Would you please also post the ticket url so I can track it. Thank you again, -A On Feb 20, 10:39 am, Joni Freeman wrote: > Ok, this was yet another bug in serialization code. It is now fixed > and should be in next snapshot build. Deserializing null values were > not supported. Note a

[Lift] Re: serializing and deserializing a json object through Lift-JSON

2010-02-20 Thread Joni Freeman
Ok, this was yet another bug in serialization code. It is now fixed and should be in next snapshot build. Deserializing null values were not supported. Note a recommended way is to use Option for optional values. This would've worked: case class X(yy: Option[Y]) case class Y(ss: String) from(to(X

[Lift] Re: serializing and deserializing a json object through Lift-JSON

2010-02-19 Thread Ali
Thanks for your reply. Actually I was trying to build an exception I am receiving in our product. case class X(yy:Y) case class Y(ss:String) def from(in:String):X={ implicit val formats = net.liftweb.json.DefaultFormats import net.liftweb.json.JsonAST._ import net.liftweb.json.Extra

[Lift] Re: serializing and deserializing a json object through Lift-JSON

2010-02-19 Thread Joni Freeman
Is X perhaps an inner class? Inner class has an implicit reference to outer instance. Serializing those is not supported. If so, please move definition of X outside of class. Cheers Joni On Feb 20, 12:16 am, Ali wrote: > Hi, >  I am wondering, could you please let me know what is wrong in the >

[Lift] Re: serializing and deserializing a json object through Lift-JSON

2010-02-19 Thread Joni Freeman
Hi, Can't reproduce that. Those lines should work just fine. From which line do you get that exception (please attach full stack trace too)? Cheers Joni On Feb 20, 12:16 am, Ali wrote: > Hi, >  I am wondering, could you please let me know what is wrong in the > following code: > > case class X(

[Lift] Re: serializing and deserializing a json object through Lift-JSON

2010-02-19 Thread Ali
Hi, I am wondering, could you please let me know what is wrong in the following code: case class X(vv:String) val sample = new X("A") implicit val formats = net.liftweb.json.DefaultFormats import net.liftweb.json.JsonAST._ import net.liftweb.json.Extraction._ import net.l

[Lift] Re: serializing and deserializing a json object through Lift-JSON

2010-02-17 Thread Joni Freeman
Fix is in master now. Should be in next snapshot build too. Cheers Joni On Feb 17, 3:27 pm, Ali wrote: > Thank you :) > -A > > On Feb 17, 1:23 pm, Joni Freeman wrote: > > > Hi Ali, > > > I added a ticket for > > this:http://www.assembla.com/spaces/liftweb/tickets/352-do-not-serialize-t...) > >

[Lift] Re: serializing and deserializing a json object through Lift-JSON

2010-02-17 Thread Ali
Thank you :) -A On Feb 17, 1:23 pm, Joni Freeman wrote: > Hi Ali, > > I added a ticket for > this:http://www.assembla.com/spaces/liftweb/tickets/352-do-not-serialize-t...) > > Meanwhile, you can cleanup the serialized JSON for instance by using > 'remove' function. Something like: > > val cleanJ

[Lift] Re: serializing and deserializing a json object through Lift-JSON

2010-02-17 Thread Joni Freeman
Hi Ali, I added a ticket for this: http://www.assembla.com/spaces/liftweb/tickets/352-do-not-serialize-the-internal-state-of-a-case-class-(json) Meanwhile, you can cleanup the serialized JSON for instance by using 'remove' function. Something like: val cleanJson = decompose(x) remove { case JF

[Lift] Re: serializing and deserializing a json object through Lift-JSON

2010-02-17 Thread Ali
Hi, I just updated to the latest lift-json snapshot and tried to serialize one of my case classes: The output starts with: { "bitmap$0":0, "sell_exp":null, "buy_exp":null, "x$3":null, "sell_exp_str":null, "buy_exp_str":null, "x$2":null, "sell_vars":null, "buy_vars":null, "x$1

[Lift] Re: serializing and deserializing a json object through Lift-JSON

2010-02-14 Thread Joni Freeman
Hi, I just added Array support and fixed the bug 341. It is now waiting on review board for others to comment. You can checkout branch 'joni_issue_341' if you want to try it immediately. This test case now passes (Please note the verbose assertions in second test case. Those are needed because sc

[Lift] Re: serializing and deserializing a json object through Lift-JSON

2010-02-11 Thread Joni Freeman
Hi, Yes, that's true. Arrays are not yet supported. Just Option, List and Map. Adding array support (which should be trivial) is on TODO list though. Cheers Joni On Feb 11, 12:09 pm, Ali wrote: > Thanks guys, Actually my problem is still there, It looks like lift- > json doesn't support scala-a

[Lift] Re: serializing and deserializing a json object through Lift-JSON

2010-02-11 Thread Ali
Thanks guys, Actually my problem is still there, It looks like lift- json doesn't support scala-arrays. case class Plan( leftOperand:Option[Action], operator:Option[String], rightOperand:Option[Action]) case class Game(buy:Map[String,Plan]) case class Acti

[Lift] Re: serializing and deserializing a json object through Lift-JSON

2010-02-10 Thread Joni Freeman
Hi, Type hints should not be needed in this case since the Map is not used in a polymorphic way. But the work-around Justin showed should work. Actually it seems that it is enough to put type info just to Action to make serialization work: implicit val format = Serialization.formats(ShortType