Validating the dataset in JOSM gives you warnings about nodes on the same position. Click fix for this type of warning should work. However this only merges the nodes, not the single way segments.