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:
parent
27258ed6dd
commit
3ba771507d
3 changed files with 38 additions and 19 deletions
|
|
@ -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())
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue