Create QByteArray JSON with special characters (é, ...) as unicode (\uxxxx)
Unsolved
General and Desktop
-
I would like to create a simple JSON structure like follow :
{ "é" : 1 }
And to finally get it as a valid JSON
QByteArray
.Here is my code in order to achieve this :
QJsonObject data; data.insert("é", 1); QJsonDocument jsonDoc(data); QByteArray bjsonData = jsonDoc.toJson();
But here the "é" is stored as "\xC3\xA9", it is the UTF-8 representation of the character but I would like to get "\u00e9" instead (the unicode code point) as specified by the JSON RFC.
Is there a way to get escaped Unicode value instead of escaped utf-8 value ?