Solved QJsonDocument, strip whitespace
-
Is there a function or method already in existence to strip the whitespace from a JSON object?
When I use the toJson function I get something like:
{\n "name": "Simon Platten" \n}\n
I want to convert this to:
{"name":"Simon Platten"}
I'm asking because I don't want to waste time writing something if it already exists.
-
@SPlatten
So look at this overload https://doc.qt.io/qt-5/qjsondocument.html#toJson-1 and theQJsonDocument::JsonFormat
parameter, which has two choices. -
@SPlatten
So look at this overload https://doc.qt.io/qt-5/qjsondocument.html#toJson-1 and theQJsonDocument::JsonFormat
parameter, which has two choices. -
@JonB , doh!, Perfect, thank you, completely overlooked that one!