I remember my professor in college challenging me with this question, which I failed to answer satisfactorily: I know there exists a bijection between the rational numbers and the natural numbers, but can anyone produce an explicit formula for such a bijection?
In order to create this function, one needs to look at this in several parts and then assemble the pieces together to produce the final function.
First you'll need the following series:
One series is the numerator and the other the denominator. An explicit function to generate each series will be needed (try wikipedia or other online math resources to find these)
Then a way to cycle through this a second time so that all values are negative will be needed.
The easiest way to think of assembling all these parts is most likely composite functions.
Use the old (-1)^n trick for switching to negative values.
A professor showed me this function once, I've been trying to look for it in old notes but to no avail. If I remember correctly, it uses composite functions and floors/ceilings.
Sorry if this was not helpful to you in your pursuits.