json4s: one json ast to rule them all.

619 views
Skip to first unread message

Ivan Porto Carrero

unread,
Aug 29, 2012, 11:21:30 AM8/29/12
to scala...@googlegroups.com
Hi, 

At this moment there are at least 6 json libraries for scala, not counting the java json libraries. All these libraries have a very similar AST. This project aims to provide a single AST to be used by other scala json libraries.

https://github.com/json4s/json4s

I've extracted lift-json from lift and renamed its package to be native. It's still licensed under the same license etc.
So the current AST is based on the the JValue from lift-json with the addition that it now also supports using bigdecimal in addition of a double to represent decimal values.

You can still use the Formats provided by lift-json but it also supports the approach Play2 has taken with type classes. On a JValue there are 3 new methods which take a Reader (Reads) as implicit to extract values.

I've also included a parser that uses jackson instead of the native scala parser provided by lift-json.

I hope this is a project you guys think is worth pursuing and want to contribute to. It helps a lot when you want to/have to support different json libraries.

Eduardo Pareja Tobes

unread,
Aug 29, 2012, 11:45:36 AM8/29/12
to Ivan Porto Carrero, scala...@googlegroups.com

nice!

are you aware of Rosetta Json?

--
Eduardo Pareja Tobes

Alex Cruise

unread,
Aug 29, 2012, 2:24:48 PM8/29/12
to Ivan Porto Carrero, scala...@googlegroups.com
On Wed, Aug 29, 2012 at 8:21 AM, Ivan Porto Carrero <iv...@flanders.co.nz> wrote:
At this moment there are at least 6 json libraries for scala, not counting the java json libraries. All these libraries have a very similar AST. This project aims to provide a single AST to be used by other scala json libraries.


Awesome! I hope, if it's any good, that everyone will agree on it and adopt it quickly. ;)

-0xe1a

Matthew Pocock

unread,
Aug 30, 2012, 7:14:17 AM8/30/12
to Alex Cruise, Ivan Porto Carrero, scala...@googlegroups.com
http://xkcd.com/927/

Standards
--
Dr Matthew Pocock
Integrative Bioinformatics Group, School of Computing Science, Newcastle University
skype: matthew.pocock
tel: (0191) 2566550

doug

unread,
Aug 30, 2012, 1:35:39 PM8/30/12
to scala...@googlegroups.com, Ivan Porto Carrero

Ivan Porto Carrero

unread,
Aug 30, 2012, 6:36:03 PM8/30/12
to scala...@googlegroups.com, Ivan Porto Carrero
I removed the jackson-scala-module dependency and published the project for a bunch of scala versions.



before I accidentally published with crosspaths disabled, that has also been addressed obviously.

Ivan Porto Carrero

unread,
Sep 4, 2012, 7:29:05 AM9/4/12
to scala...@googlegroups.com, Ivan Porto Carrero
There is now also a scala 2.10 build available for json4s

I don't think it will be possible to support both scala 2.8 and 2.10 from the same codebase, mostly because of the different scalaz versions required

Kaspar Fischer

unread,
Nov 6, 2012, 4:51:13 AM11/6/12
to scala...@googlegroups.com, Ivan Porto Carrero
Hi Ivan, 

I was wondering whether the 2.10-RC1 release (or snapshot) of json4s is available publicly somewhere?

Thanks,
Kaspar

Kaspar Fischer

unread,
Nov 6, 2012, 4:59:01 AM11/6/12
to scala...@googlegroups.com, Ivan Porto Carrero

Jacobus

unread,
Nov 6, 2012, 8:40:20 AM11/6/12
to scala...@googlegroups.com
Hi,

I use spray-json (https://github.com/spray/spray-json) but json4s looks like a great project also. I realise I'm not comparing apples with apples, as they are serving different purposes.

json4s may also be well suited to serve as a Slick (http://slick.typesafe.com/) driver - Allowing you to 'query' JSON over webservices in a similar fashion to the way you would query a database.

Best regards,
Jacobus
Reply all
Reply to author
Forward
0 new messages