Let us suppose something happened first to John and then to me. Is it grammatically correct to say:
It happened the same to me as John.
And if it is not, how would express this meaning, then?
The same happened to me as happened to John.
The same happened to me as to John.
The same thing happened to me as it did to John.
It would need to be:
It happened the same to me as to John.
You need to repeat the "to". In order to make it easier to read though, I would add another couple of words:
It happened the same to me as it did to John.
No, it's not grammatically correct. To express that, you'd say "what happened to John also happened to me" or simply "what happened to John happened to me ..."