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. Something about Parsing JSON with QT and VS2010
Forum Updated to NodeBB v4.3 + New Features

Something about Parsing JSON with QT and VS2010

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.5k 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.
  • D Offline
    D Offline
    dev_jiang
    wrote on last edited by
    #1

    @
    QScriptValue value;
    QScriptEngine engine;
    QByteArray enUrl = "http://mobilecdn.kugou.com/new/app/i/search.php?keyword=walking&cmd=300&pagesize=100";
    QNetworkReply *reply = manager->get(QNetworkRequest(QUrl(enUrl)));
    QByteArray musicJson = reply->readAll();
    value =engine.evaluate("(" + QString(musicJson) + ")");
    @

    the problem is :
    musicJson have data, but when I parsing, the value is empty;
    do somebody have the same problem?

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tucnak
      wrote on last edited by
      #2

      Hi, ~dev_jiang!

      Evaluating JSON with QScriptEngine is not the best idea. If to be honest - it's a bad practise. Why is? Just cos it takes too much memory. Use it only if you need to evaluate JavaScript code, not it's notation.

      There is one of my favourite libraries - QJson. It allows to work with JSON on the QVariant* level. Read, write, serialize, etc.

      Project link: http://qjson.sourceforge.net/

      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