Skip to content

Instantly share code, notes, and snippets.

@skvark
Last active December 31, 2015 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skvark/7973420 to your computer and use it in GitHub Desktop.
Save skvark/7973420 to your computer and use it in GitHub Desktop.
How to clean Juvenes API dirty JSON data (Qt5).
// Cleans dirty QByteArray so that it can be read to QJsonDocument
void cleanJSON(QByteArray &dirty) {
// remove "}); from the end
dirty.remove(dirty.length() - 4, 4);
// remove ({"d":" from the beginning
dirty.remove(0, 7);
// replace \ -> empty
const char* remove = "\\";
const char* replace = "";
dirty.replace(remove, replace);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment