check the length of contents before trying to load it through json