[Lift] lift-json serialization

2010-02-08 Thread harryh
A feature request. Right now I might have a case class like so: case class User(firstname: String, lastname: String) which serializes to something like: { "firstname" : "Harry", "lastname" : "Heymann" } but I happen to be serializing a lot of People and I hate to use 17 bytes per item for the

[Lift] lift-Json doesn't appear to be correctly handling attributes.

2010-02-02 Thread Jonathan Ferguson
When converting XML to Json attributes are being lost, given the below XML document, we would expect {"word":{"word":"content","self":"http://localhost:8080/word/example ","term":"example","available":"true"}} where as we get {"word":"content"} example XML: http://localhost:8080/word/example"; avai

Re: [Lift] lift-json and illegal field names

2009-12-10 Thread Randall R Schulz
On Thursday December 10 2009, harryh wrote: > ... > > since this won't work (as type is a scala keyword): > > case class Foo(type: String) Back-ticks forgive all: case class Foo(`type`: String) > -harryh Randall Schulz -- You received this message because you are subscribed to the Google Gr

Re: [Lift] lift-json and illegal field names

2009-12-10 Thread David Pollak
On Thu, Dec 10, 2009 at 4:14 PM, harryh wrote: > I feel like there has been a post on this before, but I can't seem to > find it. How can I construct a case class that can deal with json > like so: > > { > "type" : "image" > } > > since this won't work (as type is a scala keyword): > > case cla

Re: [Lift] lift-json and illegal field names

2009-12-10 Thread Naftoli Gugenheim
Backticks. - harryh wrote: I feel like there has been a post on this before, but I can't seem to find it. How can I construct a case class that can deal with json like so: { "type" : "image" } since this won't work (as type is a scala keyword): case class

[Lift] lift-json and illegal field names

2009-12-10 Thread harryh
I feel like there has been a post on this before, but I can't seem to find it. How can I construct a case class that can deal with json like so: { "type" : "image" } since this won't work (as type is a scala keyword): case class Foo(type: String) -harryh -- You received this message becaus

[Lift] lift-json escaping bug

2009-11-30 Thread harryh
scala> import net.liftweb.json._ scala> val s2 = "{ \"id\": \"America\\/New_York\" }" s2: java.lang.String = { "id": "America\/New_York" } scala> JsonParser.parse(s2) res1: net.liftweb.json.JsonAST.JValue = JObject(List(JField(id,JString (America\New_York It should be America/New_York but for

[Lift] lift-json question related to Lists of things

2009-11-25 Thread harryh
consider: case class Foo(id: Int, bars: List[Bar]) case class Bar(id: Int) val foo = json.extract[Foo] The following json will cause a problem: { "id": 12 } This can be fixed by changing bars to an Option[List[Bar]]. Should that really be necessary though? Can't bars just be an empty list

[Lift] lift-json bug (in Xml.toJson)

2009-11-10 Thread harryh
This is on M7: scala> import scala.xml.Elem import scala.xml.Elem scala> import net.liftweb.json.JsonAST._ import net.liftweb.json.JsonAST._ scala> import net.liftweb.json._ import net.liftweb.json._ scala> def go(e: Elem) = Printer.pretty(render(Xml.toJson (e))) go: (scala.xml.Elem)String sc

[Lift] lift-json serialization primitive types

2009-10-25 Thread Christophe Dehlinger
Hi, Is there a way to configure lift-json's case class serialization so that it uses Joda DateTimes instead of java.util.Date ? I'd like to known how to make the simple following code work as expected: import net.liftweb.json._ import org.joda.time._ case class MyCaseClass(dt: DateTime) object

[Lift] lift-json and attributes

2009-10-05 Thread Richard Dallaway
Loving the new lift-json code. We've been producing XML for a REST API, and now need to produce JSON. lift-json to the rescue, except...the Xml converter doesn't handle attributes: scala> val xml = Bert xml: scala.xml.Elem = Bert scala> val json = toJson(xml) json: net.liftweb.json.JsonAST.JVa

[Lift] lift-json serialization

2009-09-21 Thread Tim Nelson
First of all thanks for a great library. I'm finding lift-json quite useful in my current project. I have a use case where I need to convert a case class into a JObject. The code is there, but it's wrapped inside the Serialization object. So, I took the liberty of moving the serialize method to th

[Lift] lift-json

2009-09-13 Thread linxbetter
Hello, I saw a post about lift-json on the scala-user list so I decided to check it out. I was particularly interested in the ability to call something along the lines of json.extract[MyClass]. I set up a little test case for this though, and apparently having a val of any sort in my case class