Another nine people were injured at an informal settlement in Cleveland late on Tuesday.
Hundreds of Ghanaians are being repatriated from South Africa following rising tensions over illegal immigration.
South Africa's president says people's concerns should not "breed... hatred towards fellow Africans".
A further 10 people were injured in Bekkersdal after the perpetrators opened fire and "continued to shoot randomly".
Africa Eye reporter Ayanda Charlie investigates Johannesburg's abandoned and hijacked buildings ahead of G20 summit.
Some residents in the heart of the South African city are living amid sewage in derelict buildings run by criminal gangs.
The final report into the fire that killed 77 people in Johannesburg calls for more housing for poor people.
The deadly fire was called a "wake-up call" but ex-residents now live in dangerous temporary shelters.
Johannesburg is known as a dangerous city, but some people are working to change that reputation.