11

Jersey framework uses both Jackson and Jettison libraries for JSON unmarshalling/marshalling. AFAIK, Jettison is for for mapping JSON to XML (with different mechanism support like mapped notation) and Jackson is for JSON generation/parsing (I'm using this without Jersey also).

Will Jersey using these two for two different functionalities or both for same JSON generation/parsing functionality?

I only want support JSON format. At my first thought, it seems I can remove either of the dependencies and I think I can remove Jettison as Jacksone seems more natural choice for JSON generation/parsing.

tshepang
  • 12,111
  • 21
  • 91
  • 136
manikanta
  • 8,100
  • 5
  • 59
  • 66

2 Answers2

7

Jersey will use one or the other, not both, for all JSON processing. Recommendation as far as I know is to use Jackson; Jettison support is older and was implemented before Jackson became available. Jettison is still supported for compatibility reasons but unless some code relies on exact structure it produces (which differs from straight-forward mapping) there's little benefit from using it.

StaxMan
  • 113,358
  • 34
  • 211
  • 239
  • Thanks. But I m seeing the Jettison as dependency (I m using Maven), even though I m using regular/straight-forward mapping? – manikanta Sep 01 '11 at 11:29
  • Yeah if something else needs it (either during runtime or maybe just for compilation, as is the case for Jersey I think), it needs to be included. But whether it gets used is configurable with Jersey, and there is no harm in including it. – StaxMan Sep 02 '11 at 06:05
  • 6
    I disagree with the term "There is no harm in including it". Knowing what is used for what is important. Maven is making developers lazy and projects bloated. – Glenn Bech Sep 11 '11 at 08:41
  • I agree with the general sentiment, and personally I try to minimize dependencies. But once you do know purpose of a specific library there's limited benefit in trying to trim dependencies of packages you have little control over, which is the case wrt Jersey's inclusion of some of providers. – StaxMan Sep 14 '11 at 17:16
1

I agree, use Jackson or even GSON from google. Jettison has too much limitations and the performance is also lower.

Rafa
  • 2,328
  • 3
  • 27
  • 44