Skip to content
StringHelpers

MinifyJson

Internal helper function
static std::string MinifyJson(const std::string jsonCode);

A static helper function.

Will return the minified version of jsonCode.
Will also remove comments.

Exceptions

Allthough just minifying json is quite forgiving, it still has to parse the string quotation marks.
So, if these are fucked, it WILL raise a JsonParsingMissingQuotesException!


Example:

myCode:
{
    "key1": "value1",
    "key2": 555,
    "key3": [1, 2, 3, 4, 5],
    "key4": {
        "key41": "lol",
        "key42": "Uvuvwevwevwe Onyetenyevwe Ugwemuhwem Osas"
    }
}
C++:
StringHelpers::MinifyJson(myCode);
Returns:
{"key1":"value1","key2":555,"key3":[1,2,3,4,5],"key4":{"key41":"lol","key42":"Uvuvwevwevwe Onyetenyevwe Ugwemuhwem Osas"}}