error checking in the json communication