Hyrrokkin icon indicating copy to clipboard operation
Hyrrokkin copied to clipboard

Jackson and other guidelines

Open miguelcobain opened this issue 10 years ago • 2 comments

I'm very interested in this project because I'm using Java as a backend for my Ember app (I'm using Jackson). I'd be very happy to invest some time on this.

What do you think of implementing this project as a Jackson serializer/deserializer + annotations? From what I can tell, Jackson has some performance advantages over Gson, and it is used as a default in many web frameworks, but maybe Gson has some advantages as well.

miguelcobain avatar Jan 27 '15 16:01 miguelcobain

What would the advantage of Jackson give as opposed to the Gson library that's already included?

Ideally, though, Hyrrokkin should support a pluggable JSON-library, so that the use can choose which one they prefer.

joachimhs avatar Jan 30 '15 08:01 joachimhs

Ok, I can see this project following one of two paths:

  1. Using a JSON-library, i.e. we use the library to build our JSON, but the "client" of our project never knows about which library we use
  2. Extending a JSON-library, i.e. we extend a library using some

Currently this project is using the first approach, it seems. However, I would rather use something like the second approach.

Jackson (and Gson, from what I read) has the notion of Serializers and Deserializers itself, through pluggable modules. Example: https://github.com/FasterXML/jackson-datatype-hibernate This is a jackson module that enables support for hibernate datatypes. Something like that could be done for serializing json that ember expects.

Another advantage of the second approach is that many frameworks (spring, JAX-RS stuff, etc) are completely prepared for Jackson, for example. I don't need to do anything to serialize my entities with Jackson out of the box. Using something custom, like the first approach, would require more configuration, probably.

Also, AFAIK, Jackson is one of the most performant JSON libraries out there. But I have no concrete proof of that.

miguelcobain avatar Jan 30 '15 11:01 miguelcobain