guard against invalid JSON