#1 Re: mORMot 1 » bug with JSON parsing » 2018-01-29 20:42:08

I can't understand what to do, may be spot of code will help me to understand.

if you mean use of  asks : array of array of string; instead of asks : array of array[0..1] of string;
it doesn't work.

#2 Re: mORMot 1 » bug with JSON parsing » 2018-01-29 17:48:38

ab can you please explain why this happens:

Here is working type declaration for the code below :
type
  TRLi = packed record
    timestamp: string;
    bids  : array of array[0..1] of string;
    asks     : array of array[0..1] of string;
  end;

And here is declaration that won't work:
type
  TRLi = packed record
    timestamp: string;
    asks : array of array[0..1] of string;
    bids     : array of array[0..1] of string;   
  end;

both types are same, but RecordLoadJSON doesn't work with second Type as I expect

procedure TForm1.Button1Click(Sender: TObject);
var   s : UTF8String;
      RLi: TRLi;

begin
      s:=  '{"timestamp": "1","asks": [["2", "3"], ["4", "5"]],"bids": [["6", "7"], ["8", "9"], ["10", "11"]]}'  ;
      RecordLoadJSON(RLi, @s[1], typeinfo(TRLi) );
      Caption := Length(RLi.asks).ToString + ':' +  Length(RLi.bids).ToString; //2 : 3
end;

#3 mORMot 1 » bug with JSON parsing » 2018-01-29 01:51:38

skipjack
Replies: 7

This seems to be a bug with json parsing. Please try my code.

all fields are fine except bids that's every time is 0



type
  TRL i= packed record
    timestamp: integer;
    asks     : array of array[0..1] of string;
    bids     : array of array[0..1] of string;
  end;

var   s : UTF8String;
      RLi: TRLi;

s:= quoted text below
.............
        RecordLoadJSON(RLi, @s[1], typeinfo(TRLi) );
        Caption := Length(RLi.asks).ToString + ':' +  Length(RLi.bids).ToString; //208 : 0
..................

Board footer

Powered by FluxBB