Move ID generation to after JSON transformation