1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-25 02:04:23 +00:00

Avoid unnecessary zeros when writing double values to XML or JSON

This commit is contained in:
ed 2018-12-17 16:17:53 +00:00
parent 27258ed6dd
commit 3ba771507d
3 changed files with 38 additions and 19 deletions

View file

@ -351,9 +351,14 @@ struct JSONFormatter
auto d = static_cast<double> (v);
if (juce_isfinite (d))
out << String (d, maximumDecimalPlaces);
{
String doubleString (d, maximumDecimalPlaces);
out << doubleString.substring (0, (int) CharacterFunctions::findLengthWithoutTrailingZeros (doubleString.getCharPointer()));
}
else
{
out << "null";
}
}
else if (v.isArray())
{