[Lazarus] JSON float saving scientific value
Michael Van Canneyt
michael at freepascal.org
Sun Nov 6 16:22:09 CET 2011
On Sun, 6 Nov 2011, tcoq wrote:
> either you recode the function below:
> "function TJSONFloatNumber.GetAsString: TJSONStringType;
> Either by changing to using formatted string conversion, using FloatToStrF function.
You should definitely not do that, because then the resulting string is localized.
JSON is not localized. It MUST use a . as the decimal separator.
> by implementing your new type yourself, something like "TJSNExtFloatNumber" which overrides the GetAsString function.
> The second way should work without changing the JSON base code. However loading a JSON stream will still get you the base TJSONFloatNumber.
The best way probably is to extend FormatJSON to accept a new option and use that when returning JSON data.
More information about the Lazarus