Handle empty JSON files gracefully

This ensures endptr is always set to something sensible even if the input data was completely empty.
Merge pull request #2 from ChrisJefferson/patch-1

Handle empty JSON files gracefully