Message error: expected unqualified-id before '{' token

{
  char clientStr[34];
  clientName.toCharArray(clientStr, 34);
  char topicStr[26];
  topicName.toCharArray(topicStr, 26);
  getData();
  if (!client.connected()) {
    Serial.print("Trying to connect to: ");
    Serial.println(clientStr);
    client.connect(clientStr);
  }
  if (client.connected() ) {
    String json = buildJson();
    char jsonStr[200];
    json.toCharArray(jsonStr, 200);
    boolean pubresult = client.publish(topicStr, jsonStr);
    Serial.print("attempt to send ");
    Serial.println(jsonStr);
    Serial.print("to ");
    Serial.println(topicStr);
    if (pubresult)
      Serial.println("successfully sent");
    else
      Serial.println("unsuccessfully sent");
  }
  delay(5000);
}

I try to report Temperature readings to IBM IoT Page using Arduino UNO and DHT11 Temperature sensor, but the compiler report the error in this block of code. Thanks in advance for your help

That is NOT all your code. Have a look at How to use the forum.

Post ALL the code and ALL the error. Or better, actually read the whole error instead of just a part :wink: