Important: Please read the Qt Code of Conduct -

JSON.stringify problem

  • I use QWebEngineView to load a simple webpage:
    view = new QWebEngineView(this);
    The web page is:
    <!doctype html>
    <meta charset="utf-8">

    var par={var1:"123","var2":456};

    The alert window is:

    Note that all the quote marks in the object are encoded as html entities How could this happen? How to get the orignal " not html entities. The Qt version I use is Qt 5.10.0 MSVC2017 64 bit.


  • @yetanotherqtfan
    Don't understand what your problem/issue/question is? That output is the JSON stringification of the object. All that stringify should gurantee is that the resulting string can be passed around safely, and that JSON.parse(JSON.stringify(obj)) should return an object that is the same JS object as you started with. So what does JSON.parse() return in your case?

    &quot; is the HTML entitization of the " character.

Log in to reply