Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved TCP/IP or serial port data is JSON : process it to C++ structure: and use that info # QT QML C++

    General and Desktop
    3
    4
    640
    Loading More Posts
    • 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.
    • P
      Prasad_Socionext last edited by

      Hi

      I have a scenario where I get data from a serial or TCPIP port in Json.
      I need to first of all check if the JSON string exist and then convert it into C++ structure and further use the info to process information to plot , display info on GUI extra.

      I used to do the whole process in Matlab and now I have to do it in QT QML.

      Right now I am able to:
      1.) Connect to serial or TCP port and send cmd to receive data.
      2.) I want to now check if JSON string is present in the data received and convert it into C++ structure.
      3.) Basically I will use the info from this structure to to display it on the QML GUI, or may be use the data points and plot them on the graph.

      could any one help me how to go about point 2 and 3. Any small existing example would be great.

      Regards
      Prasad

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        Since you are sing QtQuick, why not handle the JSON directly in the javascript portion of your code ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        P 1 Reply Last reply Reply Quote 2
        • P
          Prasad_Socionext @SGaist last edited by

          @SGaist hi any example on how to do that. Or could you put some light on it with some few sentences I would try to figure it out myself.

          aha_1980 1 Reply Last reply Reply Quote 0
          • aha_1980
            aha_1980 Lifetime Qt Champion @Prasad_Socionext last edited by

            @Prasad_Socionext

            Have you already read https://doc.qt.io/qt-5.11/qtqml-cppintegration-overview.html ?

            And I agree with @SGaist, JSON is JavaScript Object Notation, so you should easily be able to handle JSON on the JavaScript side. For documentation on how to do that, use Google :)

            Qt has to stay free or it will die.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post