You are not logged in.
Pages: 1
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.
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;
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
..................
Pages: 1