More extensive checking for valid JSON

...slightly