- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
[ANN] Literaljson 0.1
Wed, 2009-07-08, 17:39
JSON toolkit for Scala
http://github.com/jonifreeman/literaljson/tree/master
Features:
* DSL to create JSON
* Quite fast parser, 200 times faster than standard Scala JSON parser
according to one benchmark:
http://github.com/jonifreeman/literaljson/tree/be575a9eda0f2cee75d2665ef...
* Compact formatting
* Pretty printing
* XPath like queries
Cheers, Joni
Wed, 2009-07-08, 19:07
#2
Re: [ANN] Literaljson 0.1
On Wed, 2009-07-08 at 10:56 -0700, Blair Zajac wrote:
> Joni Freeman wrote:
> > JSON toolkit for Scala
> > http://github.com/jonifreeman/literaljson/tree/master
>
> Thanks!
>
> BTW, this doesn't tell me which JVM the benchmark was run with:
>
> Java HotSpot(TM) Server VM (build 11.0-b15, mixed mode)
>
> Is it 1.5 or 1.6? The 11.0-b15 is the minor release of the Java release. You
> could include the entire java -version info.
Oh, that's true. It was java6, full version info added:
http://github.com/jonifreeman/literaljson/tree/3f4e0b08ebae3bb731a21000e...
Cheers, Joni
Wed, 2009-07-08, 20:17
#3
Re: [ANN] Literaljson 0.1
Any benchmark against Jackson?
On Wed, Jul 8, 2009 at 1:39 PM, Joni Freeman <joni.freeman@reaktor.fi> wrote:
--
Daniel C. Sobral
Something I learned in academia: there are three kinds of academic reviews: review by name, review by reference and review by value.
On Wed, Jul 8, 2009 at 1:39 PM, Joni Freeman <joni.freeman@reaktor.fi> wrote:
JSON toolkit for Scala
http://github.com/jonifreeman/literaljson/tree/master
Features:
* DSL to create JSON
* Quite fast parser, 200 times faster than standard Scala JSON parser
according to one benchmark:
http://github.com/jonifreeman/literaljson/tree/be575a9eda0f2cee75d2665ef48aa4abf601c06d/benchmark
* Compact formatting
* Pretty printing
* XPath like queries
Cheers, Joni
--
Daniel C. Sobral
Something I learned in academia: there are three kinds of academic reviews: review by name, review by reference and review by value.
Wed, 2009-07-08, 21:37
#4
Re: [ANN] Literaljson 0.1
I'm not sure I like the implicit that adds "~" to Tuple2. I think this kind of stuff should either require a domain-specific type, or be defined inside a trait, so that it is easier to control it's scope.
On Wed, Jul 8, 2009 at 1:39 PM, Joni Freeman <joni.freeman@reaktor.fi> wrote:
--
Daniel C. Sobral
Something I learned in academia: there are three kinds of academic reviews: review by name, review by reference and review by value.
On Wed, Jul 8, 2009 at 1:39 PM, Joni Freeman <joni.freeman@reaktor.fi> wrote:
JSON toolkit for Scala
http://github.com/jonifreeman/literaljson/tree/master
Features:
* DSL to create JSON
* Quite fast parser, 200 times faster than standard Scala JSON parser
according to one benchmark:
http://github.com/jonifreeman/literaljson/tree/be575a9eda0f2cee75d2665ef48aa4abf601c06d/benchmark
* Compact formatting
* Pretty printing
* XPath like queries
Cheers, Joni
--
Daniel C. Sobral
Something I learned in academia: there are three kinds of academic reviews: review by name, review by reference and review by value.
Thu, 2009-07-09, 05:37
#5
Re: [ANN] Literaljson 0.1
I agree that such implicit conversions should preferably be targeted for
more specific types. But I couldn't figure out any solution without
sacrificing the readability of DSL. I'm open for any suggestions, the
implementation is just a thin layer on top of AST and can be tweaked
easily.
The DSL is defined in object JsonDSL and needs to be imported into
scope. Scala allows import statements in many places thus it is already
possible to control the scope of those implicits (*). I'm not sure what
would it buy to move the definitions inside a trait. Or am I missing
something?
(*)
object scopetest extends Application {
println("hello")
{
import literaljson.JsonDSL._
val foo = ("foo" -> 1) ~ ("bar" -> 2)
println(foo)
}
println("world")
}
Cheers Joni
On Wed, 2009-07-08 at 17:26 -0300, Daniel Sobral wrote:
> I'm not sure I like the implicit that adds "~" to Tuple2. I think this
> kind of stuff should either require a domain-specific type, or be
> defined inside a trait, so that it is easier to control it's scope.
>
> On Wed, Jul 8, 2009 at 1:39 PM, Joni Freeman
> wrote:
> JSON toolkit for Scala
> http://github.com/jonifreeman/literaljson/tree/master
>
> Features:
>
> * DSL to create JSON
> * Quite fast parser, 200 times faster than standard Scala JSON
> parser
> according to one benchmark:
> http://github.com/jonifreeman/literaljson/tree/be575a9eda0f2cee75d2665ef...
> * Compact formatting
> * Pretty printing
> * XPath like queries
>
> Cheers, Joni
>
>
>
>
>
>
Thu, 2009-07-09, 05:47
#6
Re: [ANN] Literaljson 0.1
Yes, Jackson is faster:
http://github.com/jonifreeman/literaljson/tree/13607aba8dce9769bfcf71731...
I'm pretty sure there's a few optimizations which could bring
Literaljson closer to Jackson though.
Cheers Joni
On Wed, 2009-07-08 at 16:10 -0300, Daniel Sobral wrote:
> Any benchmark against Jackson?
>
> On Wed, Jul 8, 2009 at 1:39 PM, Joni Freeman
> wrote:
> JSON toolkit for Scala
> http://github.com/jonifreeman/literaljson/tree/master
>
> Features:
>
> * DSL to create JSON
> * Quite fast parser, 200 times faster than standard Scala JSON
> parser
> according to one benchmark:
> http://github.com/jonifreeman/literaljson/tree/be575a9eda0f2cee75d2665ef...
> * Compact formatting
> * Pretty printing
> * XPath like queries
>
> Cheers, Joni
>
>
>
>
>
>
Thu, 2009-07-09, 16:37
#7
Re: [ANN] Literaljson 0.1
Oh, the trait thing is just an implicit import of implicits. :-) It forces the scope to be a class or object, though.
The only suggestion I can think of is creating a JSON "Nil" json object, so that every json expression would be started like "JSON ~ ...", thus foregoing the need for an implicit. Naturally, "~" in object JSON would be defined as returning a json instance of the pair/list to it's right.
Does that make sense? Do you feel it would overburden the syntax?
On Thu, Jul 9, 2009 at 1:36 AM, Joni Freeman <joni.freeman@reaktor.fi> wrote:
--
Daniel C. Sobral
Something I learned in academia: there are three kinds of academic reviews: review by name, review by reference and review by value.
The only suggestion I can think of is creating a JSON "Nil" json object, so that every json expression would be started like "JSON ~ ...", thus foregoing the need for an implicit. Naturally, "~" in object JSON would be defined as returning a json instance of the pair/list to it's right.
Does that make sense? Do you feel it would overburden the syntax?
On Thu, Jul 9, 2009 at 1:36 AM, Joni Freeman <joni.freeman@reaktor.fi> wrote:
I agree that such implicit conversions should preferably be targeted for
more specific types. But I couldn't figure out any solution without
sacrificing the readability of DSL. I'm open for any suggestions, the
implementation is just a thin layer on top of AST and can be tweaked
easily.
The DSL is defined in object JsonDSL and needs to be imported into
scope. Scala allows import statements in many places thus it is already
possible to control the scope of those implicits (*). I'm not sure what
would it buy to move the definitions inside a trait. Or am I missing
something?
(*)
object scopetest extends Application {
println("hello")
{
import literaljson.JsonDSL._
val foo = ("foo" -> 1) ~ ("bar" -> 2)
println(foo)
}
println("world")
}
Cheers Joni
On Wed, 2009-07-08 at 17:26 -0300, Daniel Sobral wrote:
> I'm not sure I like the implicit that adds "~" to Tuple2. I think this
> kind of stuff should either require a domain-specific type, or be
> defined inside a trait, so that it is easier to control it's scope.
>
> On Wed, Jul 8, 2009 at 1:39 PM, Joni Freeman <joni.freeman@reaktor.fi>
> wrote:
> JSON toolkit for Scala
> http://github.com/jonifreeman/literaljson/tree/master
>
> Features:
>
> * DSL to create JSON
> * Quite fast parser, 200 times faster than standard Scala JSON
> parser
> according to one benchmark:
> http://github.com/jonifreeman/literaljson/tree/be575a9eda0f2cee75d2665ef48aa4abf601c06d/benchmark
> * Compact formatting
> * Pretty printing
> * XPath like queries
>
> Cheers, Joni
>
>
>
>
>
>
> --
> Daniel C. Sobral
>
> Something I learned in academia: there are three kinds of academic
> reviews: review by name, review by reference and review by value.
--
Daniel C. Sobral
Something I learned in academia: there are three kinds of academic reviews: review by name, review by reference and review by value.
Mon, 2009-07-13, 09:37
#8
Re: [ANN] Literaljson 0.1
Hi Daniel,
I'm not sure if introducing Nil object would be enough. It isn't clear
where Nil object(s) should be inserted for instance in this example
case.
("person" ->
("name" -> "Joe") ~
("age" -> 35) ~
("spouse" ->
("person" ->
("name" -> "Marilyn") ~
("age" -> 33)
)
)
)
Cheers Joni
On Thu, 2009-07-09 at 12:31 -0300, Daniel Sobral wrote:
> Oh, the trait thing is just an implicit import of implicits. :-) It
> forces the scope to be a class or object, though.
>
>
> The only suggestion I can think of is creating a JSON "Nil" json
> object, so that every json expression would be started like "JSON
> ~ ...", thus foregoing the need for an implicit. Naturally, "~" in
> object JSON would be defined as returning a json instance of the
> pair/list to it's right.
>
>
> Does that make sense? Do you feel it would overburden the syntax?
>
> On Thu, Jul 9, 2009 at 1:36 AM, Joni Freeman
> wrote:
> I agree that such implicit conversions should preferably be
> targeted for
> more specific types. But I couldn't figure out any solution
> without
> sacrificing the readability of DSL. I'm open for any
> suggestions, the
> implementation is just a thin layer on top of AST and can be
> tweaked
> easily.
>
> The DSL is defined in object JsonDSL and needs to be imported
> into
> scope. Scala allows import statements in many places thus it
> is already
> possible to control the scope of those implicits (*). I'm not
> sure what
> would it buy to move the definitions inside a trait. Or am I
> missing
> something?
>
> (*)
> object scopetest extends Application {
> println("hello")
>
> {
> import literaljson.JsonDSL._
> val foo = ("foo" -> 1) ~ ("bar" -> 2)
> println(foo)
> }
>
> println("world")
> }
>
>
> Cheers Joni
>
>
> On Wed, 2009-07-08 at 17:26 -0300, Daniel Sobral wrote:
> > I'm not sure I like the implicit that adds "~" to Tuple2. I
> think this
> > kind of stuff should either require a domain-specific type,
> or be
> > defined inside a trait, so that it is easier to control it's
> scope.
> >
> > On Wed, Jul 8, 2009 at 1:39 PM, Joni Freeman
>
> > wrote:
> > JSON toolkit for Scala
> >
> http://github.com/jonifreeman/literaljson/tree/master
> >
> > Features:
> >
> > * DSL to create JSON
> > * Quite fast parser, 200 times faster than standard
> Scala JSON
> > parser
> > according to one benchmark:
> >
> http://github.com/jonifreeman/literaljson/tree/be575a9eda0f2cee75d2665ef...
> > * Compact formatting
> > * Pretty printing
> > * XPath like queries
> >
> > Cheers, Joni
> >
> >
> >
> >
> >
> >
> > --
> > Daniel C. Sobral
> >
> > Something I learned in academia: there are three kinds of
> academic
> > reviews: review by name, review by reference and review by
> value.
>
>
>
>
>
Mon, 2009-07-13, 16:27
#9
Re: [ANN] Literaljson 0.1
I see the problem. Indeed, it would require adding the "Nil" object in many places, which would certainly detract from the DSL.
Ok, then, I have no other suggestions. :-)
On Mon, Jul 13, 2009 at 5:32 AM, Joni Freeman <joni.freeman@reaktor.fi> wrote:
--
Daniel C. Sobral
Something I learned in academia: there are three kinds of academic reviews: review by name, review by reference and review by value.
On Mon, Jul 13, 2009 at 5:32 AM, Joni Freeman <joni.freeman@reaktor.fi> wrote:
Hi Daniel,
I'm not sure if introducing Nil object would be enough. It isn't clear
where Nil object(s) should be inserted for instance in this example
case.
("person" ->
("name" -> "Joe") ~
("age" -> 35) ~
("spouse" ->
("person" ->
("name" -> "Marilyn") ~
("age" -> 33)
)
)
)
Cheers Joni
On Thu, 2009-07-09 at 12:31 -0300, Daniel Sobral wrote:
> Oh, the trait thing is just an implicit import of implicits. :-) It
> forces the scope to be a class or object, though.
>
>
> The only suggestion I can think of is creating a JSON "Nil" json
> object, so that every json expression would be started like "JSON
> ~ ...", thus foregoing the need for an implicit. Naturally, "~" in
> object JSON would be defined as returning a json instance of the
> pair/list to it's right.
>
>
> Does that make sense? Do you feel it would overburden the syntax?
>
> On Thu, Jul 9, 2009 at 1:36 AM, Joni Freeman <joni.freeman@reaktor.fi>
> wrote:
> I agree that such implicit conversions should preferably be
> targeted for
> more specific types. But I couldn't figure out any solution
> without
> sacrificing the readability of DSL. I'm open for any
> suggestions, the
> implementation is just a thin layer on top of AST and can be
> tweaked
> easily.
>
> The DSL is defined in object JsonDSL and needs to be imported
> into
> scope. Scala allows import statements in many places thus it
> is already
> possible to control the scope of those implicits (*). I'm not
> sure what
> would it buy to move the definitions inside a trait. Or am I
> missing
> something?
>
> (*)
> object scopetest extends Application {
> println("hello")
>
> {
> import literaljson.JsonDSL._
> val foo = ("foo" -> 1) ~ ("bar" -> 2)
> println(foo)
> }
>
> println("world")
> }
>
>
> Cheers Joni
>
>
> On Wed, 2009-07-08 at 17:26 -0300, Daniel Sobral wrote:
> > I'm not sure I like the implicit that adds "~" to Tuple2. I
> think this
> > kind of stuff should either require a domain-specific type,
> or be
> > defined inside a trait, so that it is easier to control it's
> scope.
> >
> > On Wed, Jul 8, 2009 at 1:39 PM, Joni Freeman
> <joni.freeman@reaktor.fi>
> > wrote:
> > JSON toolkit for Scala
> >
> http://github.com/jonifreeman/literaljson/tree/master
> >
> > Features:
> >
> > * DSL to create JSON
> > * Quite fast parser, 200 times faster than standard
> Scala JSON
> > parser
> > according to one benchmark:
> >
> http://github.com/jonifreeman/literaljson/tree/be575a9eda0f2cee75d2665ef48aa4abf601c06d/benchmark
> > * Compact formatting
> > * Pretty printing
> > * XPath like queries
> >
> > Cheers, Joni
> >
> >
> >
> >
> >
> >
> > --
> > Daniel C. Sobral
> >
> > Something I learned in academia: there are three kinds of
> academic
> > reviews: review by name, review by reference and review by
> value.
>
>
>
>
>
> --
> Daniel C. Sobral
>
> Something I learned in academia: there are three kinds of academic
> reviews: review by name, review by reference and review by value.
>
--
Daniel C. Sobral
Something I learned in academia: there are three kinds of academic reviews: review by name, review by reference and review by value.
Joni Freeman wrote:
> JSON toolkit for Scala
> http://github.com/jonifreeman/literaljson/tree/master
Thanks!
BTW, this doesn't tell me which JVM the benchmark was run with:
Java HotSpot(TM) Server VM (build 11.0-b15, mixed mode)
Is it 1.5 or 1.6? The 11.0-b15 is the minor release of the Java release. You
could include the entire java -version info.
Regards,
Blair