Use toData() with kotlinx.serialization instead.
toData()
Return a JSON-serializable object representing the range.