#1 2018-06-05 11:25:29

patron
Member
Registered: 2018-06-05
Posts: 4

Building JSON format using the dvoAllowDoubleValue

I think something is wrong when building JSON using the dvoAllowDoubleValue option for a floating-point value (exponent)

Example:

   TFileEntity = packed record
     double_params: TDoubleDynArray;
   end;

   raw: RawUTF8;
   entity: TFileEntity;
   header: Variant;

   SetLength (entity.double_params, 4);
   entity.double_params [0]: = -12.12345678;
   entity.double_params [1]: = -9.9e-15;
   entity.double_params [2]: = -9.88e-15;
   entity.double_params [3]: = -9.e-15;
   raw: = RecordSaveJSON (entity, TypeInfo (TFileEntity));
   header: = _Json (raw, [dvoReturnNullForUnknownProperty, dvoAllowDoubleValue]);

"raw" return correct value:
{"double_params":[-12.12345678,-9.9E-15,-9.88E-15,-9E-15]}

but, when the conversion to JSON is done, in the position 2 of the double_params array I have the quotes:
header = '{"double_params":[-12.12345678,"-9.9E-15",-9.88E-15,-9E-15]}'

I use dvoAllowDoubleValue but it does not eliminate quotes in this situation:
"-9.9E-15" => bad
-9.9E-15 => ok

ps. Uses the last version of mORMot

Offline

#2 2018-06-05 20:56:28

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,244
Website

Re: Building JSON format using the dvoAllowDoubleValue

Should be fixed by https://synopse.info/fossil/info/ee60f02c55

Thanks for the feedback and sorry for the inconvenience.

Offline

#3 2018-06-06 10:17:44

patron
Member
Registered: 2018-06-05
Posts: 4

Re: Building JSON format using the dvoAllowDoubleValue

I confirm, it's ok now. thank you very much.

Offline

Board footer

Powered by FluxBB