better error checking of json slurp