Last active
December 31, 2015 10:29
-
-
Save skvark/7973420 to your computer and use it in GitHub Desktop.
How to clean Juvenes API dirty JSON data (Qt5).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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