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. error: ‘fromJSON’ is not a member of ‘QJsonDocument’
Qt 6.11 is out! See what's new in the release blog

error: ‘fromJSON’ is not a member of ‘QJsonDocument’

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 337 Views 1 Watching
  • 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.
  • V Offline
    V Offline
    Vamsi Krishna P
    wrote on last edited by
    #1

    I am facing compilation issue while accessing "fromJSON".

    code:
    ```
    QByteArray json_bytes = state.toLocal8Bit();
    QJsonParseError error;
    QJsonDocument json_doc = QJsonDocument::fromJSON(json_bytes, &error);

    	
    compilation error:
    	error: ‘fromJSON’ is not a member of ‘QJsonDocument’
    
    need help...
    J.HilkJ 1 Reply Last reply
    0
    • V Vamsi Krishna P

      I am facing compilation issue while accessing "fromJSON".

      code:
      ```
      QByteArray json_bytes = state.toLocal8Bit();
      QJsonParseError error;
      QJsonDocument json_doc = QJsonDocument::fromJSON(json_bytes, &error);

      	
      compilation error:
      	error: ‘fromJSON’ is not a member of ‘QJsonDocument’
      
      need help...
      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by J.Hilk
      #2

      @Vamsi-Krishna-P

      I assume you did #include <QJsonDocument> ?

      seems obvious now that @sierdzio pointed it out...


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      0
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #3

        It's fromJson not fromJSON. Use an IDE, it will auto-correct such errors.

        (Z(:^

        1 Reply Last reply
        5
        • V Offline
          V Offline
          Vamsi Krishna P
          wrote on last edited by
          #4

          Thanks,
          I start using an IDE

          1 Reply Last reply
          0

          • Login

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