Woodlice are from the class Crustacea family and the members of this family include shrimps, crabs, and lobsters.
They are insects that are found usually under rotting pieces of wood.
They have a shell-like exoskeleton, which it must progressively shed as it grows.
Woodlice can also invade homes en masse in search of moisture and their presence can indicate dampness problems.
They are not generally regarded as a serious household pest as they do not spread disease and do not damage sound wood or structures. (source)
So can hamsters eat woodlice?
No they can’t due to the bacteria that they could possibly contain having been out in the wild. Its just too much of a risk for them.
If they happen to eat one, just keep an eye on the hamster to ensure their are no ill effects from eating it.