lightcouch / LightCouch

CouchDB Java API
www.lightcouch.org
Apache License 2.0
68 stars 70 forks source link

Using Jackson instead of gson #23

Closed dongshengbc closed 7 years ago

dongshengbc commented 11 years ago

Gson is chosen as the JSON serializer, but it seems Jackson is more and more popular.

And I am wondering if it is possible to change to to Jackson? Or maybe give user the option?

dvberkel commented 11 years ago

I will look into this. For starters, below is a list of source files referencing gson. I used the following command to generate the list

find src/ -name '*.java' | xargs grep -i gson | cut -d ':' -f 1 | sort | uniq

Files referencing gson

src/main/java/org/lightcouch/Attachment.java
src/main/java/org/lightcouch/Changes.java
src/main/java/org/lightcouch/ChangesResult.java
src/main/java/org/lightcouch/CouchDbClientBase.java
src/main/java/org/lightcouch/CouchDbClient.java
src/main/java/org/lightcouch/CouchDbContext.java
src/main/java/org/lightcouch/CouchDbInfo.java
src/main/java/org/lightcouch/CouchDbUtil.java
src/main/java/org/lightcouch/DesignDocument.java
src/main/java/org/lightcouch/Document.java
src/main/java/org/lightcouch/Replication.java
src/main/java/org/lightcouch/ReplicationResult.java
src/main/java/org/lightcouch/ReplicatorDocument.java
src/main/java/org/lightcouch/Replicator.java
src/main/java/org/lightcouch/View.java
src/main/java/org/lightcouch/ViewResult.java
src/test/java/org/lightcouch/tests/CouchDbClientTest.java
dongshengbc commented 11 years ago

Thanks for starting on this, just thought you could use grep with -l option

grep -l

How can we make this happen? Thoughts?

dvberkel commented 11 years ago

@dongshengbc Thanks for the pointer. I did not know about the -l option.

I looked into the problem and came up with the following scenario.

  1. Create an LightCouch API for all JSON related data structures and operations.
  2. Provide gson/Jackson wrapper.

It is feasible but is considerable amount of work. It probably amounts to redoing a lot of work done by gson and jackson.

The only win would be that LightCouch would prepare it self for future JSON libraries.

It all depends on the view that @ahmedyha has with this project. I would be willing to aid if it really is what we want.

dongshengbc commented 11 years ago

Yeah, that would be my approach too. I am willing to help as well.

dongshengbc commented 11 years ago

Another reason to do this is:

We use Jackson for all the other parts of our project. It will be nicer we do not need to include two JSON library. This might not be a big deal for a desktop application. I am working on a mobile library. The library itself is only < 100K.

ahmedyha commented 11 years ago

Hi,

It should be as good to use Jackson; considering the amount of work for re-writing some portions of the code, could be interesting. I had a preference for Gson for it's nicer API and performance.

dongshengbc commented 11 years ago

It is not because gson is not as good as Jackson, just want to gave developer option to choose the Json library they want.

​ 

Dongsheng Wang, Mobile Team Cloudant, Distributed Database as a Service

Sent from Mailbox for iPhone

On Tue, May 28, 2013 at 9:35 AM, ahmedyha notifications@github.com wrote:

Hi, It should be as good to use Jackson; considering the amount of work for re-writing some portions of the code, could be interesting.

I had a preference for Gson for it's nicer API and performance.

Reply to this email directly or view it on GitHub: https://github.com/ahmedyha/LightCouch/issues/23#issuecomment-18550474

ahmedyha commented 11 years ago

Having the option can be great, however it doesn't seem a straightforward job to integrate both implementation within the same code.

dvberkel commented 11 years ago

I will give this a shot this weekend and report my progress back here. Depending on the progress we can make an educated guess if we want to go with the plan.

dvberkel commented 11 years ago

Unfortunately I was not able to work on LightCouch this weekend and I am going on a holiday. I will not be able to work on this until the end of this month.

dvberkel commented 11 years ago

I will be switching projects soon so I will be unable to work on LightCouch.

I will keep following the progress closely, but will be unable to contribute anything substantial.

timjacobi commented 10 years ago

Why was this closed? Would like to see Jackson being used for performance reasons.

rama0120 commented 9 years ago

Do we have any updates here on this effort to decouple lightcouch from gson? We have a case of mixed libraries, Jackson and gson - as mentioned 2 years ago, Jackson is seeing a lot more Dev and growth than gson.

lightcouch commented 7 years ago

Closing this as won't fix.

LightCouch will continue to use Gson as its primary JSON/Java mapping. Incorporating Jackson and Gson in the same repo appears not possible.