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 return QJsonObject from scripted call via engine evaluate?
Qt 6.11 is out! See what's new in the release blog

How to return QJsonObject from scripted call via engine evaluate?

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 270 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.
  • SPlattenS Offline
    SPlattenS Offline
    SPlatten
    wrote on last edited by
    #1

    I am calling a JavaScript function using QJSEngine, the JavaScript function returns a JSON object. How can I accept this from the evaluate call?

    I want to assign it to an instance of QJsonObject.

    Kind Regards,
    Sy

    KroMignonK 1 Reply Last reply
    0
    • SPlattenS SPlatten

      I am calling a JavaScript function using QJSEngine, the JavaScript function returns a JSON object. How can I accept this from the evaluate call?

      I want to assign it to an instance of QJsonObject.

      KroMignonK Offline
      KroMignonK Offline
      KroMignon
      wrote on last edited by
      #2

      @SPlatten The easiest way is to convert it to string (objectName.toString()) and parse the string with QJsonDocument::fromJson().

      It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

      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