Adding exception handling for malformed json.