Hi, team. I want to extract timestamp from a Kafka topic. There’re two kinds of message structure in this topic.
One message structure is like
{
“version”: “2.0",
“body”: {
“timestamp”: {
“$time”: “1655768409120"
}
}
}
Another message structure is like:
{
“version”: “3.0",
“body”: {
“timestamp”: 1655768409120
}
}
I can use jsonPathString to extract “timestamp” separately.
{
“columnName”: “timestamp”,
“transformFunction”: “jsonPathLong(body, ‘$.timestamp.$time’)”
}
{
“columnName”: “timestamp”,
“transformFunction”: “jsonPathLong(body, ‘$.timestamp’)”
}
Any idea how to extract “timestamp” from the above two message structures using just one function?