Skip to content

Suggestion replacing Gson with Jackson in default DataConverter implementation #991

Description

@mr2chethan

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions