In book 4, Plato finally offers what he would consider societal justice. He says that justice is everyone doing the job most suited to them, and having a well ordered soul. I think that this definition makes much more sense when one thinks of it in the context of the city being an analogy for a person's soul.
Like how the Guardians need to be the leaders of the city and the lower class workers need to be the laborers, the different parts of your soul need to be fulfilling their optimal duties for you to be just. For example, allowing your appetites to govern all of your decisions would lead to an unjust soul just like allowing the masses to lead the city would lead to chaos in the city.
I don't particularly like Plato's definition of justice because I feel as if it rules out the possibility for the uneducated people to be just. To make the truly good decisions, according to Plato, you need to have knowledge, something that a lot of people in our world may not have access to. But, I think people that don't have knowledge can still sometimes intuitively know what is just and what is not. I think it would be better to say that a more knowledgeable person will be just more often, but it is not as if the unlearned man will always be unjust.