Handle empty JSON files gracefully

This ensures endptr is always set to something sensible even if the input data was completely empty.