Make sure it works with different types of file like objects.

Turns out the weird behaviour was not pypy specific but rather a
features of the JSON library. Not sure why it previously only manifested
on pypy.