More extensive checking for valid JSON

...slightly
Merge pull request #28 from elimisteve/patch-1

More extensive checking for valid JSON