moved normalizeId to JSONSerializer

This is pr #1914 rebased against the current master.