how to get indented JSON values in C++ ?
-
The
pageid
value in your JSON is not a string but rather an integer, hence you have to useQJsonValue::toInt()
instead ofQJsonValue::toString()
:jsonResponse.object()["parse"].toObject()["pageid"].toInt();
-
Hi All,
Need some help from you,
How to remove "\n" between Two Json Attribute while printing . -
@Anil-Patel
Hi
Show how you "print" please ? -
@mrjj {
"app": "PromotionDngineyscad",
"host": "WINASBAV7d7d750142-UBN",
"log": "PromoLog",
"lvl": "Messages",
"msg": "Initialized",
"thread": "237fbb2db10",
"timestamp": "1533796312.526572",
"uuid": "e62191c4-8891-4c92-a908-da01a3dakje3ac7ad"
} -
@Anil-Patel You should reread the question from @mrjj
-
@Anil-Patel
I did mean the code :)
if you use printf, qDebug, or what ever.You could use QString's replace if the newline are truely in the the json string. -
@Anil-Patel Hi,
Please make a new post for a new question, even more if you are not the author of the original question...For your issue, I think you need to call
QJsonDocument::toJson(
QJsonDocument::Compact)
when you export your json content to string.