C++. Make ugly json string into a readable pretty json string.
Turns this:
{"a":4,"b":{"p":"2","d":4,"e":[1,2,3]},"c":["t",4,2,3,{"a":1,"b":2}]}
Into this:
{
"a" : 4,
"b" : {
"p" : "2",
"d" : 4,
"e" : [
1,
2,
3
]
},
"c" : [
"t",
4,
2,
3,
{
"a" : 1,
"b" : 2
}
]
}
#include "JSONPrettify.h"
This one doesn't add spaces inbetween colons.
std::string json = "... some json data ...";
std::string pretty = boris::JSONPrettify( json );
Neither does this one
std::string json = "... some json data ...";
std::string pretty = boris::JSONPrettify( json , boris::Colons::TIGHT );
This one adds spaces inbetween colons. Spaces inbetween colons aren't fully complete - if you have colons in the middle of variable names or values it will put spaces. ie.: "a:b":1 -> "a : b" : 1
std::string json = "... some json data ...";
std::string pretty = boris::JSONPrettify( json , boris::Colons::SPACED );