Skip to content

Conversation

@neelkanth-kaushik
Copy link
Contributor

@neelkanth-kaushik neelkanth-kaushik commented Aug 18, 2025

This pull request adds support for serializing and deserializing Java Instant objects as ISO8601-formatted strings using Gson. The main changes include introducing a new adapter for Instant, updating the Gson configuration to use this adapter, and making related utility and import changes.

Support for ISO8601 serialization/deserialization of Instant:

  • Added a new ISO8601InstantAdapter class that implements both JsonSerializer and JsonDeserializer for Instant, enabling conversion between Instant objects and ISO8601 strings for Gson serialization and deserialization.
  • Registered the new ISO8601InstantAdapter with the GsonBuilder in the Analytics class, so all Instant fields are now handled automatically.
  • Imported Instant and the new adapter in Analytics.java to support the new functionality.

Utility enhancements:

  • Added a format(Instant instant) method to Iso8601Utils to provide ISO8601 formatting for Instant objects (currently returns epoch seconds as a string; may need enhancement for full ISO8601 compliance).
  • Updated imports in Iso8601Utils.java to include Instant.

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

Successfully merging this pull request may close these issues.

2 participants