mORMot2 icon indicating copy to clipboard operation
mORMot2 copied to clipboard

JSON Array Bug

Open Coldzer0 opened this issue 1 year ago • 1 comments

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(Screen.MonitorCount) 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

  • Free Pascal Compiler version 3.3.1-15358-gb40d312521 [2024/08/29] for x86_64
  • Embarcadero® RAD Studio 12 Version 29.0.51961.7529

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 avatar Aug 30 '24 12:08 Coldzer0

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

Coldzer0 avatar Aug 30 '24 12:08 Coldzer0

So please close the issue?

synopse avatar Aug 30 '24 14:08 synopse