Hi,
Serialization feature is actually a very thin layer on top of
decompose and extract functions. So, one way to accomplish that is to
use directly those functions and map the field names.
So, instead of this:
write(x, out)
Try this:
val json = decompose(x) map {
case JField("firstname", x)
Thanks,
The fix is on review board now. Should be in master pretty soon. Note,
I made two changes to the test case you provided.
The expected result of example1 is:
{"word":"content","self":"http://localhost:8080/word/
example","term":"example","available":"true"}
The transformation converts XML
Thanks Joni,
I've opened a ticket http://github.com/dpp/liftweb/issues/issue/323.
Cheers
Jono
On 3 February 2010 17:46, Joni Freeman wrote:
> Hi Jonathan,
>
> Yes, definitely a bug. Could you please open a ticket (http://
> github.com/dpp/liftweb/issues) and I will take a look at it. And
> th
Hi Jonathan,
Yes, definitely a bug. Could you please open a ticket (http://
github.com/dpp/liftweb/issues) and I will take a look at it. And
thanks for the test case!
Cheers Joni
On Feb 3, 3:41 am, Jonathan Ferguson wrote:
> When converting XML to Json attributes are being lost, given the below
Thx all! Just couldn't remember that little trick.
-harryh
--
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to
liftweb+unsubscr...@googlegroups.c
Fixed:
d977c95589fbd5de8bc45e43c2867097dd75a807
-Ross
On Nov 30, 2009, at 8:33 PM, harryh wrote:
> Done:
>
> http://github.com/dpp/liftweb/issues/#issue/214
>
> On Nov 30, 6:33 pm, Ross Mellgren wrote:
>> If you file an issue on github I'll write up a patch for you tonight.
>>
>> -Ross
>>
Hi,
This is from JSON RFC (http://www.ietf.org/rfc/rfc4627.txt): "A JSON
text is a serialized object or array."
I checked with another parser (http://www.jsonlint.com) and it fails
too when given just JSON value:
"syntax error, unexpected TNUMBER, expecting '{' or '[' at line 1"
So perhaps a bet
On review board: http://reviewboard.liftweb.net/r/131/
I did run across another infelicity when writing the test -- apparently
JsonParser crashes when given a scalar value, as opposed to an array or object:
scala> parse("\"foobar\"")
net.liftweb.json.JsonParser$ParseException: unexpected null
Ne
Done:
http://github.com/dpp/liftweb/issues/#issue/214
On Nov 30, 6:33 pm, Ross Mellgren wrote:
> If you file an issue on github I'll write up a patch for you tonight.
>
> -Ross
>
> On Nov 30, 2009, at 6:30 PM, harryh wrote:
>
> > Yes, what Ross said. Further, taking a look at JsonParser.scala t
What I find particularly interesting is that the JSON spec lacks \',
but gains \/, relative to the ECMA-262 (javascript) spec that JSON
supposedly derives from.
-Ross
On Nov 30, 2009, at 6:34 PM, Nathan Folkman (Foursquare) wrote:
> Here's the complete list from http://json.org/:
>
> char:
>
Here's the complete list from http://json.org/:
char:
Any Unicode character except " or \ or control-character.
\"
\\
\/
\b
\f
\n
\r
\t
\u four-hex-digits
- n
On Nov 30, 6:30 pm, harryh wrote:
> Yes, what Ross said. Further, taking a look at JsonParser.scala the
> bug appears to be on line ~
If you file an issue on github I'll write up a patch for you tonight.
-Ross
On Nov 30, 2009, at 6:30 PM, harryh wrote:
> Yes, what Ross said. Further, taking a look at JsonParser.scala the
> bug appears to be on line ~202 where there are a couple of missing
> escape sequences: \/ as well as \f.
Yes, what Ross said. Further, taking a look at JsonParser.scala the
bug appears to be on line ~202 where there are a couple of missing
escape sequences: \/ as well as \f.
-harryh
On Nov 30, 6:20 pm, Ross Mellgren wrote:
> He's double escaping so that scala's string interpretation will put a
>
He's double escaping so that scala's string interpretation will put a
raw \ in there, so that it's an escaped forward slash (\/) to the JSON
parson, as I understand it. The output should be either invalid escape
or forward slash, but not backslash unless the input was \\.
-Ross
On Nov 30, 2
Harry, I think you're double-escaping the slash. This works:
scala> import net.liftweb.json._
scala> val s1 = "{ \"id\": \"America/New_York\" }"
s1: java.lang.String = { "id": "America/New_York" }
scala> JsonParser.parse(s1)
res0: net.liftweb.json.JsonAST.JValue = JObject(List(JField(id,JString
(A
Hi,
Totally agreed, this makes List extraction more robust. The change is
in reviewboard now:
http://reviewboard.liftweb.net/r/127/
Cheers Joni
On 25 marras, 20:42, harryh wrote:
> consider:
>
> case class Foo(id: Int, bars: List[Bar])
> case class Bar(id: Int)
>
> val foo = json.extract[Foo]
I think a fix to this was pushed this morning. Once this job is finished:
http://hudson.scala-tools.org/job/Lift/1367/ It should be available on
SNAPSHOT.
On Tue, Nov 10, 2009 at 1:49 PM, harryh wrote:
>
> This is on M7:
>
> scala> import
> scala.xml.Elem
> import scala.xml.Elem
>
> scala> imp
Hi,
Custom serialization and deserialization functions are now supported
in trunk. Please see updated docs in section "Serializing non-
supported types":
http://github.com/dpp/liftweb/tree/master/lift-base/lift-json/
Cheers Joni
On 25 loka, 14:27, Christophe Dehlinger
wrote:
> Hi,
>
> Is the
Hi,
Serializing joda-time is not supported. Last week a type hint
mechanism was added to support serialization of polymorphic Lists.
This could be generalized a bit so that users can provide de-/
serializers for any type. This could be done for instance using a pair
of partial functions. Somethin
On Mon, Oct 5, 2009 at 9:01 PM, Joni Freeman wrote:
>
> Thanks Richard!
>
> This is a feature request and I just committed an implementation to my
> branch.
I've just pulled 1-1 SNAPSHOT, tried it, and it works just how I need it to.
Thank you
Richard
--~--~-~--~~~-
On Tue, Oct 6, 2009 at 9:03 AM, harryh wrote:
>
> > This is a feature request and I just committed an implementation to my
> > branch.
>
> This looks great. If there is anyway it could get committed to master
> in time for M6 (which is coming out any day now right?) that would be
> very very hel
> This is a feature request and I just committed an implementation to my
> branch.
This looks great. If there is anyway it could get committed to master
in time for M6 (which is coming out any day now right?) that would be
very very helpful to me.
Thanks for your work on this stuff Joni!
-harr
Thanks Richard!
This is a feature request and I just committed an implementation to my
branch. I modified existing example to contain few attributes to show
how they are mapped:
http://github.com/dpp/liftweb/blob/joni_wip_xml/lift-json/src/test/scala/net/liftweb/json/XmlExamples.scala
If other
Excellent. Thanks.
On Thu, Sep 24, 2009 at 2:21 AM, Joni Freeman wrote:
>
> Tim,
>
> Extracted function is now in master. I renamed it as 'decompose' since
> it decomposes case class into JSON AST.
>
> Thanks again, Joni
>
> On Sep 21, 6:52 pm, Tim Nelson wrote:
> > First of all thanks for a gre
Tim,
Extracted function is now in master. I renamed it as 'decompose' since
it decomposes case class into JSON AST.
Thanks again, Joni
On Sep 21, 6:52 pm, Tim Nelson wrote:
> First of all thanks for a great library. I'm finding lift-json quite useful
> in my current project.
>
> I have a use c
Oh, I see the point now and agree that this is useful. Let's add thia
to API. Thanks a lot!
Cheers Joni
On Sep 21, 6:52 pm, Tim Nelson wrote:
> 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 ca
Hi Tim,
Thanks for the kind words! The serialization functions should already
be publicly accessible, you just need to import them into scope:
import net.liftweb.json.Serialization.{read, write}
val ser = write(...)
val obj = read[..](ser)
Cheers Joni
On Sep 21, 6:52 pm, Tim Nelson wrote:
>
Got it. Thanks for the info. I was afraid I was doing something wrong.
Thanks,
Lincoln
On Sun, Sep 13, 2009 at 9:48 AM, Joni Freeman wrote:
>
> Hi,
>
> Your example should work if you take the val away from your case
> class:
>
> case class MyName(first:String, last:String)
> case class MyUser(
Hi,
Your example should work if you take the val away from your case
class:
case class MyName(first:String, last:String)
case class MyUser(id:String, name:MyName, url:String)
The reflection code currently fails to find the primary constructor of
case class if there's extra fields. This will hop
Sorry, here's the full code I'm using:
case class MyName(first:String, last:String)
case class MyUser(id:String, name:MyName, url:String) {
val wtf = "wtf"
}
implicit val formats = net.liftweb.json.DefaultFormats
val json =
("id" -> me.id) ~
("name" ->
("first" -> me.name.first) ~
("last" -> me
30 matches
Mail list logo