Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

192
Views
How to build up a 2d json array by qjsonarry in qt5

i need to buid a json array just like

 var data1 = [
  [3, 0],
  [15, 90],
  [18, 180],
  [15, 270],
  [12, 0],
  [9, 120],
  [10, 90],
  [18, 30],
  [20, 150],
  [21, 120],
  [18, 100],
  [15, 240],
  [12, 270],
  [9, 120],
  [10, 90],
  [18, 30],
  [3, 150],
  [15, 120],
  [18, 100],
  [15, 240],
  [12, 270],
  [9, 120],
  [10, 90],
  [18, 30],
];

i can build a simple oneline array by using QJsonArray,like this

QString CTestDataModel::ParseToJsonArray(std::vector<double> input)
{
    QJsonArray jsonArray;
    QJsonDocument jsonDoc;
    QByteArray byteArray;

    if (input.empty())
    {
        return QString(" ");
    }

    for (double num:input)
    {
        jsonArray.append(num);
    }
    jsonDoc.setArray(jsonArray);
    byteArray = jsonDoc.toJson(QJsonDocument::Compact);

    QString jsonResult(byteArray);
    return jsonResult;
}

result will be like

var data1= [2500, 1800, 1200, 1600, 3000, 4000, 3500, 2200, 2500, 1800, 1200, 1600, 3000, 4200, 3500, 2200, 2500, 1800, 1200, 1600, 3000, 4000, 3500, 2200];

but it's not what i want,how can i build a 2d js array by use QJsonArray in at5

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!