at 12:50 AM, Joni Freeman freeman.j...@gmail.com
wrote:
This is a tricky one. The problem with extending the AST is that the
AST is implemented as an algebraic data type. And by definition it is
not possible to extend such a type.
Just throwing an idea out and it's likely a bad one.
I
This is a tricky one. The problem with extending the AST is that the
AST is implemented as an algebraic data type. And by definition it is
not possible to extend such a type.
One way to add BSON support is to create a new AST for it which
includes all extended literals. Then add a few core
Note, it is very easy to clean up the JSON before rendering by using
'map' function:
json map {
case JString(s) = JString(sripOutBinaryChars(s))
case x = x
}
(You just need to implement that sripOutBinaryChars function...).
Cheers Joni
On Mar 5, 8:26 pm, Dano olearydani...@gmail.com wrote:
Hi David,
Does this work?
for {
user - WorkerMgr.find(UserId(user)) ?~ User not found
json - r.json
JField(messageId, JInt(messageId)) - json
JField(timestamp, JInt(timemillis)) - json
} yield ..
Cheers Joni
On Mar 4, 9:28 pm, David Pollak
)) - json
} yield (messageId, timemillis))
} yield ...
Cheers Joni
On Mar 4, 9:55 pm, Joni Freeman freeman.j...@gmail.com wrote:
Hi David,
Does this work?
for {
user - WorkerMgr.find(UserId(user)) ?~ User not found
json - r.json
JField(messageId, JInt
)
at net.liftweb.json.Extraction$$anonfun$newInstance
$1$1.apply(Extraction.scala:199)
at net.liftweb.json.Extraction$$anonfun$newInstance
$1$1.apply(Extraction.scala:199)
at scala.List.map(List.scala:812)
I appreciate your comment,
Thanks,
-A
On Feb 20, 12:10 am, Joni Freeman freeman.j
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 saleh...@gmail.com wrote:
Hi,
I am wondering, could you please let me know what is wrong in the
following code:
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 saleh...@gmail.com wrote:
Hi,
I am wondering, could you please let me know what
:
- Is it possible to configure lift-json so It would not serialize
internal variables ? case class X(a:Int) {lazy val y = a}
- Is it possible to generate a clean json output without x$0 or bitmap
$0,... entries ?
Thanks,
-A
On Feb 14, 5:32 pm, Joni Freeman freeman.j...@gmail.com wrote:
Hi,
I
Fix is in master now. Should be in next snapshot build too.
Cheers Joni
On Feb 17, 3:27 pm, Ali saleh...@gmail.com wrote:
Thank you :)
-A
On Feb 17, 1:23 pm, Joni Freeman freeman.j...@gmail.com wrote:
Hi Ali,
I added a ticket for
this:http://www.assembla.com/spaces/liftweb/tickets
is not correct (missing the inParams field from the action
class).
I appreciate your comment,
Cheers,
-A
On Feb 11, 8:44 am, Joni Freeman freeman.j...@gmail.com wrote:
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
Hi,
Unfortunately paranamer does not work with scala REPL. You need to put
LastTimestamp to .scala file, compile it and then add it to the
CLASSPATH. Hopefully Scala will get good reflection API some day. The
we can remove dependency to paranamer (which is needed to query names
of case class
appreciate your comment,
Cheers,
-A
On Feb 11, 8:44 am, Joni Freeman freeman.j...@gmail.com wrote:
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
Hi,
I believe this bug is already fixed in trunk. If I'm right, the
problem was missing conversion from JInt to float. You could fix it by
changing these values passMarkApplied:0,thresholdApplied:0 to
passMarkApplied:0.0,thresholdApplied:0.0
But it would be great if you have time to test with
11, 2010, at 5:42 PM, Joni Freeman wrote:
Hi,
I believe this bug is already fixed in trunk. If I'm right, the
problem was missing conversion from JInt to float. You could fix it by
changing these values passMarkApplied:0,thresholdApplied:0 to
passMarkApplied:0.0,thresholdApplied:0.0
Mike,
Here's one idea. Convert the XML to JSON and the fix the markup
field. Something like:
toJson(xml) map {
case JField(markup, _) = JField(markup, JString((xml \\
markup).toString))
case x = x
}
Does that work for you?
Cheers Joni
On Feb 11, 8:51 pm, Mike mike.c.single...@gmail.com
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 =
Done.
Thanks Joni
On Feb 8, 7:46 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
On Mon, Feb 8, 2010 at 9:45 AM, Joni Freeman freeman.j...@gmail.com wrote:
David,
This bug fix is waiting on RB. Don't know how critical it is but the
fix looks trivial.
Reviewed. Merge
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)
.
Cheers
Jono
On 3 February 2010 17:46, Joni Freeman freeman.j...@gmail.com 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
thanks for the test case!
Cheers Joni
On Feb 3, 3:41 am
Hi,
A colleague of mine did a skeleton project for sbt. It may give you
some hints how to proceed.
http://github.com/vvilhonen/SBT-Lift-Skeleton
Cheers Joni
On Jan 30, 8:14 am, Neil.Lv anim...@gmail.com wrote:
Hi all,
How to use the sbt with lift project ?
I try to use the sbt and
to
write mapper. So what we're doing is calling up the json file, making
it a string, putting it through the parcer and inserting it into the
table.
On Jan 11, 5:49 pm, Joni Freeman freeman.j...@gmail.com wrote:
Hi,
I'm sorry but I'm not totally sure what you are trying to accomplish
as I know, the documentation is also severely
lacking.
Cheers Joni
On 11 tammi, 13:32, Timothy Perrett timo...@getintheloop.eu wrote:
Hey Joni,
What did you think of ScalaQuery btw? Have you used it inside a lift app?
Cheers, Tim
On 11 Jan 2010, at 11:07, Joni Freeman wrote:
Ok, thanks
:
I tried some of the changes you made but not all of them, and (json\
observations).extract[Observation], I had no idea about that one.
Thank you very much for your help, it is appreciated.
On Jan 4, 1:00 am, Joni Freeman freeman.j...@gmail.com wrote:
Google Groups does not shine
Hi,
That's almost correct. I did following changes after looking into JSON
content.
1. 'notice' and 'header' are JSON arrays just like 'data'. Therefore:
case class Observation(notice: List[Notice], header: List[Header],
data: List[Data])
2. There's optional data in JSON (some datapoints are
Google Groups does not shine in formatting code snippets. Here's nicer
version:
http://paste.pocoo.org/show/161578/
Cheers Joni
On 3 tammi, 12:20, Joni Freeman freeman.j...@gmail.com wrote:
Hi,
That's almost correct. I did following changes after looking into JSON
content.
1. 'notice
Hi,
Yes, that's a way to convert JSON AST to string and vice versa. All
functions in lift-json operate on AST instances. This is lets us post-
and pre-process JSON in many ways before converting it to string. See
for instance functions map, merge, diff, \, etc. defined in JsonAST
(scaladocs still
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 better
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 har...@gmail.com wrote:
consider:
case class Foo(id: Int, bars: List[Bar])
case class Bar(id: Int)
val foo =
David, it's probably a broken Specs 1.6.1 which causes this. Please
see this:
http://github.com/robey/xrayspecs/issues/closed/#issue/1
Cheers Joni
On 23 marras, 22:06, David Pollak feeder.of.the.be...@gmail.com
wrote:
On Mon, Nov 23, 2009 at 12:02 PM, Ross Mellgren dri...@gmail.com wrote:
Hi,
There's several ways to get values from JSON.
1. Use LINQ style query comprehension:
for { JField(bar, JInt(x)) - json } yield x
2. Extract values with case classes
implicit val formats = net.liftweb.json.DefaultFormats
case class Foo(foo: Bar)
case class Bar(bar: Int)
json.extract[Foo]
Hi,
I will look into adding Box support.
Cheers Joni
On 19 marras, 21:24, David Pollak feeder.of.the.be...@gmail.com
wrote:
On Tue, Nov 17, 2009 at 10:06 PM, Joni Freeman freeman.j...@gmail.comwrote:
On 18 marras, 01:10, David Pollak feeder.of.the.be...@gmail.com
wrote:
I'd like to see
On 18 marras, 01:10, David Pollak feeder.of.the.be...@gmail.com
wrote:
I'd like to see the JSON stuff moved from Option to Box, but that's Joni's
call.
Hi,
I do not agree. We have quite a lot of lift-json users who do not yet
use other parts of Lift, and Box is not a familiar construct outside
Hi,
One idiom for deconstructing a Map is to use a pattern match:
myMap.map { case (k, v) = ... }.
For instance:
val json = (books -
books.map { b =
(id - b.id) ~
(tags - b.tags.map { case (k, v) = JField(k, v) }.toList)
}
)
Note, the explicit call toList is required
Hi,
Can you send me surefire test result file at:
lift-base/lift-json/target/surefire-reports/TEST-
net.liftweb.json.XmlExamplesTest.xml
All tests pass on my machine (Ubuntu 8.10, jdk1.6.0_10, Maven 2.0.9),
but I will investigate why it fails on your setup. You can send the
file directly to me,
Thanks for the test results. It looked like a charset problem in unit
test. I changed the assertion in test to use more robust case class
comparison instead of String comparison. Please let us know if this
fixes the build on your machine.
Committers, I pushed this small fix directly into master,
for the update Joni and sorry for not getting back sooner. I'll try
the code change you've suggested. Should I open a bug for the final example?
Cheers
Jono
2009/10/28 Joni Freeman freeman.j...@gmail.com
Hi Jonathan,
Current toJson conversion does not support this case very well
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
Hi Jonathan,
Current toJson conversion does not support this case very well. The
transformation rule is such that from each leaf XML element a JSON
field is generated.
statsfoo/stats -
stats:foo
And if that leaf element contains attributes we do not convert it
automatically to JSON object as
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.
I love it too. While it is used in many different places it always
means stuff that I do not care to name.
BTW. high priest of the lambda calculus loves it too :) It has its
roots in Haskell...
these changes in Review Board, or is this still experimental
work?
Derek
On Mon, Oct 19, 2009 at 9:02 AM, Joni Freeman freeman.j...@gmail.comwrote:
Added a way to change how 'type hints' are processed. The default is
NoTypeHints which will never output 'jsonClass' field. Then there's
, ... }
implicit val formats = Serialization.formats(FullTypeHints(classOf
[Animal] :: Nil))
- { jsonClass:com.example.Fish, ... }
TypeHints trait can be used to reduce couplings (as suggested by
Steve).
Cheers Joni
On 18 loka, 23:46, Joni Freeman freeman.j...@gmail.com wrote:
There's now some
I've been thinking this feature today a bit too. Marius raises an
important point. Adding type information and more complex
serialization scheme will introduce couplings, making it for instance
more difficult to deserialize JSON using a different language or
toolkit. On a positive side, we might
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
Hi,
I fixed this but it will slip M6. You can build a fixed version from
branch if you need it now. Please see the changeset 'Scala XML
support...':
http://github.com/dpp/liftweb/commits/joni_wip_xml
Cheers Joni
On Oct 5, 9:22 pm, harryh har...@gmail.com wrote:
Xml.toJson (in M5) is
} yield // construct Packet here
I will end up with 8 Packets. Should I be doing something like JArray
(json) - parse(s)?
Thanks for your help,
Peter
On Oct 4, 3:08 pm, Joni Freeman freeman.j...@gmail.com wrote:
I don't know how hard would it be to add this feature, so I don't know
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
Yes, that's exactly what happens here. David, do you know if this
should be considered a bug in Scala XML or should lift-json be able to
merge those Text() nodes?
Cheers Joni
On Oct 5, 9:46 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
Hmmm looks like there might be multiple Text()
I don't know how hard would it be to add this feature, so I don't know
if this is a reasonable request. This would make making JSON API
endpoints really easy for me and I hope for other people too.
This certainly sounds like a reasonable feature request, I will take a
deeper look at it.
Hi,
I pasted this to scala console and it worked. I am pretty sure that
the problem is that your case classes are inner classes. Inner classes
get one extra implicit constructor parameter, a reference to the outer
class (same way as in Java). You need to move those case classes away
from
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 tnell...@gmail.com wrote:
First of all thanks for a great library. I'm finding lift-json quite useful
in my current project.
Hi,
There is now improved XML support in lift master. See a short section
in README:
http://github.com/dpp/liftweb/tree/master/lift-json/
and some executable examples:
http://github.com/dpp/liftweb/blob/master/lift-json/src/test/scala/net/liftweb/json/XmlExamples.scala
Cheers Joni
On Sep 2,
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
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 tnell...@gmail.com 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
On Sep 14, 8:14 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
Can't you require back ticks and name the case class members the same as in
the JSON?
This works pretty well, thanks for pointing out this solution! I added
name demangling to support back ticks and removed @path annotation.
It
Hi,
That annotation is used to configure the json path when extracting
values. By default the extraction code assumes that case class
parameter names match with json field names. For instance these match:
case class Foo(bar: String, baz: Int)
{ bar: qwerty, baz: 10 }
But sometimes json field
. If not, I
think we need to rally for StaticAnnotation/ClassfileAnnotation to be joined
by their future brother RuntimeAnnotation.
- Josh
On Sun, Sep 13, 2009 at 6:31 PM, marius d. marius.dan...@gmail.com wrote:
On Sep 13, 3:15 pm, Joni Freeman freeman.j...@gmail.com wrote:
Hi
. marius.dan...@gmail.com wrote:
On Sep 13, 3:15 pm, Joni Freeman freeman.j...@gmail.com wrote:
Hi,
That annotation is used to configure the json path when extracting
values. By default the extraction code assumes that case class
parameter names match with json field names. For instance
be reflected at runtime.
Cheers Joni
On Sep 14, 1:31?am, marius d. marius.dan...@gmail.com wrote:
On Sep 13, 3:15?pm, Joni Freeman freeman.j...@gmail.com wrote:
Hi,
That annotation is used to configure the json path when extracting
values. By default the extraction code assumes
Pollak feeder.of.the.be...@gmail.com wrote:
Cool... I'd be interested in you pushing this to master and letting people
use it and give feedback.
On Wed, Sep 2, 2009 at 2:40 PM, Joni Freeman freeman.j...@gmail.com wrote:
Hi,
I just quickly spiked this and following works on my local branch
Hi,
I just quickly spiked this and following works on my local branch:
scala val xml =
foos
foo
id1/id
nameHarry/name
/foo
foo
id2/id
nameDavid/name
/foo
/foos
scala val json = toJson(xml)
scala compact(render(json))
62 matches
Mail list logo