JSON lib fixes
This commit is contained in:
parent
c17064c305
commit
a74c9682c9
1 changed files with 12 additions and 2 deletions
14
lib/json.cpp
14
lib/json.cpp
|
@ -1196,7 +1196,8 @@ std::string JSON::Value::toString() const {
|
||||||
}
|
}
|
||||||
case DOUBLE: {
|
case DOUBLE: {
|
||||||
std::stringstream st;
|
std::stringstream st;
|
||||||
st << dblVal;
|
st.precision(10);
|
||||||
|
st << std::fixed << dblVal;
|
||||||
return st.str();
|
return st.str();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1260,10 +1261,19 @@ std::string JSON::Value::toPrettyString(int indentation) const {
|
||||||
}
|
}
|
||||||
case DOUBLE: {
|
case DOUBLE: {
|
||||||
std::stringstream st;
|
std::stringstream st;
|
||||||
st << dblVal;
|
st.precision(10);
|
||||||
|
st << std::fixed << dblVal;
|
||||||
return st.str();
|
return st.str();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case BOOL: {
|
||||||
|
if (intVal != 0){
|
||||||
|
return "true";
|
||||||
|
}else{
|
||||||
|
return "false";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case STRING: {
|
case STRING: {
|
||||||
for (unsigned int i = 0; i < 201 && i < strVal.size(); ++i) {
|
for (unsigned int i = 0; i < 201 && i < strVal.size(); ++i) {
|
||||||
if (strVal[i] < 32 || strVal[i] > 126 || strVal.size() > 200) {
|
if (strVal[i] < 32 || strVal[i] > 126 || strVal.size() > 200) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue