synopse / mORMot2

OpenSource RESTful ORM/SOA/MVC Framework for Delphi and FreePascal
https://synopse.info
Other
531 stars 132 forks source link

JSON Array Bug #291

Closed Coldzer0 closed 2 months ago

Coldzer0 commented 2 months ago

Hello @synopse

I pulled the latest updates from mormot2, and I was testing this code.

function GetJSONListTest(): utf8string;
var
  JS, Item: IDocDict;
  I: integer;
begin
  JS := DocDict();
  JS.I['VER'] := 1;
  JS.A['ML'] := DocList();
  for I := 0 to Pred(3) do
  begin
    Item := DocDict();
    Item.I['ID'] := I;
    Item.I['W'] := 1024;
    Item.I['H'] := 1024;
    JS.A['ML'].Append(Item);
  end;
  Result := utf8string(JS.GetJson());
end;

Tested on

And both gives me {"VER":1,"ML":[null,null]}

This code was working before I pulled the latest updates. I'll try to see which commit causes this problem.

Coldzer0 commented 2 months ago

Oh my bad I think I need to use AppendDoc not Append

synopse commented 2 months ago

So please close the issue?