title: How to send JSON with QTcpSocket
body: <p>I can send JSON object from client to server but can not get an item from JSON object on the server.</p>
  
  <p>I've tried several examples that I found when I researched I can not solve the problem.</p>
  
  <p>Code to send JSON:</p>
  
  <pre><code>QJsonObject levan{
      {"id",1},
      {"tipo","reforço"},
      {"ca", 10},
      {"cb",0},
      {"cc",0},
      {"cd",0},
      {"ce",0},
      {"cf",0},
      {"cg",0},
      {"ch",0},
  };
  
  QJsonArray jsarray {levan};
  QJsonDocument jsDoc(jsarray);
  
  QString jsString = QString::fromLatin1(jsDoc.toJson());
  
  this-&gt;tcpSocket-&gt;write(jsString.toLatin1());
  </code></pre>
  
  <p>Code to receive JSON:</p>
  
  <pre><code>QString str = this-&gt;socket-&gt;readAll();
  
  QJsonDocument jsonResponse = QJsonDocument::fromJson(str.toLatin1());
  QJsonObject jsonObject = jsonResponse.object();
  QJsonArray jsonArray = jsonObject["levantamento"].toArray();
  
  qDebug()&lt;&lt; jsonResponse.object().value("levan");
  
  if (jsonResponse.array().empty()) {
      qDebug() &lt;&lt; "empty";
  }
  </code></pre>
  
  <p>I can present JSON as text, but I cannot get the items from the JSON.</p>