Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to convert QJsonObject to QByteArray?
Forum Updated to NodeBB v4.3 + New Features

How to convert QJsonObject to QByteArray?

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 2.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • HeerokNewbieH Offline
    HeerokNewbieH Offline
    HeerokNewbie
    wrote on last edited by
    #1

    I have QJsonObject and i want to convert it into QByteArray. Please tell me how can i perform this action?

        QByteArray byteData;
        
        QJsonObject Obj2 ={
            {"sign_in_provider", "password"}
        };
    
        QJsonObject Obj =
        {
            {"sub","8eZOneltblh5xAwtR7hSljN1hIj2"},
            {"aud","ChatApplication"},
            {"email","hgaur701@gmail.com"},
            {"email_verified",true},
            {"firebase",Obj2}
        };
    
        QJsonObject json {
    
            {"uid","8eZOneltblh5xAwtR7hSljN1hIj2"},
            {"token", Obj}
            };
        byteData = json; //Error here
        qDebug()<<byteData; 
    
    jsulmJ 1 Reply Last reply
    0
    • HeerokNewbieH HeerokNewbie

      I have QJsonObject and i want to convert it into QByteArray. Please tell me how can i perform this action?

          QByteArray byteData;
          
          QJsonObject Obj2 ={
              {"sign_in_provider", "password"}
          };
      
          QJsonObject Obj =
          {
              {"sub","8eZOneltblh5xAwtR7hSljN1hIj2"},
              {"aud","ChatApplication"},
              {"email","hgaur701@gmail.com"},
              {"email_verified",true},
              {"firebase",Obj2}
          };
      
          QJsonObject json {
      
              {"uid","8eZOneltblh5xAwtR7hSljN1hIj2"},
              {"token", Obj}
              };
          byteData = json; //Error here
          qDebug()<<byteData; 
      
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @HeerokNewbie
      https://doc.qt.io/qt-5/qjsondocument.html#setObject
      https://doc.qt.io/qt-5/qjsondocument.html#toJson

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved