Skip to content

Suggestion replacing Gson with Jackson in default DataConverter implementation #991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mr2chethan opened this issue Apr 15, 2025 · 0 comments

Comments

@mr2chethan
Copy link

Currently gson is being used in JsonDataConverter https://github.com/cadence-workflow/cadence-java-client/blob/master/src/main/java/com/uber/cadence/converter/JsonDataConverter.java. Gson has many limitations like:

  1. Handling LocalDate, LocalDateTime, etc Java 8 date/time types
    ex.
LocalDate date = LocalDate.now();
Gson gson = new Gson();
String json = gson.toJson(date);  // Outputs: "\"2025-04-14\""
LocalDate parsed = gson.fromJson(json, LocalDate.class);  // Exception: can't deserialize
  1. Handling polymorphism
    ex.
Animal dog = new Dog();
Gson gson = new Gson();
String json = gson.toJson(dog);  // Loses type info
Animal animal = gson.fromJson(json, Animal.class);  // Deserializes to Animal only, no Dog
  1. Performance

Jackson is faster for both serialization & deserialization esp for larger and nested payloads.

I would like to propose replacing Gson with Jackson as the default implementation or providing a first-party JacksonDataConverter alongside the existing Gson one, with an easy way for developers to plug it in.

Happy to contribute a PR if this sounds acceptable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant