从此 JSON(摘自完整示例):
{"sections":
[
{"layout_type":"media_grid"
,"layout_content":
{"medias":
[
{"media":
{"taken_at":1618071166
,"pk":2548887321653297579
...
,"user":
{"pk":20416852171
,"username":"_artin.53"
...
我尝试提取的值username
:
var
json, node : ISuperObject;
item,item2: IMember;
...
json := TSuperObject.Create(xs.Text); // Server response
for item in json['sections'].AsArray do
begin
for item2 in item.AsObject['medias'].AsArray do
begin
u := item2.AsObject['username'].ToString;
TThread.Synchronize (TThread.CurrentThread,
procedure ()
begin
Memo1.Lines.Add(u);
end);
end;
end;
我收到此代码的访问冲突。使用 Delphi 10.4 和 X-SuperObject 最新版本。