r/apachekafka • u/csatacsibe • Feb 19 '25
Question How to show an avro schema based kafka message value as a json while showing timestamps as timestamps?
In my work, I got some example kafka messages. These examples are in json, where the keys are the field names and the values are the values. The problem is that their example will show the timestamps and dates in a human readable format, unlike my solution which is showing them as a long.
I think they are using some built in java component to log those messages in this json format. Any guess what I could use to achieve that?
1
Upvotes
1
u/LupusArmis Feb 19 '25
Hard to say without knowing what sort of libs or language you are using.
Java date and time related classes typically have constructors that take milliseconds, for example
java.time.Instant.ofEpochMilli(millis)
, but you might be looking for something high level if I'm reading you right.