#1 Re: mORMot 1 » EConvertError with message "0.42821" is a not valid timestamp » 2017-04-07 11:08:17

I have the same issue with MySQL + ZEOS, assigning TSynDBDataSet created form TSQLDBStatement with DATETIME fields to TDataSource connected with grid causes "Is not valid timestamp" exception.

#2 Other components » Comma as decimal point in regional settings and invalid JSON » 2016-01-23 21:25:57

Sebo
Replies: 1

Hello

There is a problem with JSON generated by VariantSaveJSON when user changed decimal point to comma for English(United States) format in regional settings window.
In this case TTextWriter.AddDouble produces text with comma what makes JSON invalid.

procedure TForm1.FormShow(Sender: TObject);
var
  V: variant;
begin
  TDocVariant.New(V);
  V.num := 1.123456;
  Memo1.Lines.Add(VariantSaveJSON(v));
end;

The output is:

{"num":1,123456}

The solution is to add:

SettingsUS.DecimalSeparator := '.';

in SynCommons.InitSynCommonsConversionTables after SettingsUS initialization.

Board footer

Powered by FluxBB