Support pure JSON files as well.

The first pass at the code only supported JSON with the garbage printed
at the top. This fixes it so a JSON file starting with { also works.