AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Anzahl Einträge in JsonArray

Ein Thema von rotwildmarcy · begonnen am 19. Sep 2024 · letzter Beitrag vom 26. Sep 2024
 
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.342 Beiträge
 
Delphi 12 Athens
 
#8

AW: Anzahl Einträge in JsonArray

  Alt 20. Sep 2024, 08:50
Delphi-Quellcode:
for i := 0 to JSonArray.Count - 1 do
begin
  JsonValue := TJsonValue.ParseJSONValue(st);
  if (JSONValue is TJSONArray) then
    id := ((JSONValue as TJSONArray).Items[i] as TJSonObject).Get('id').JSONValue.Value;

  name := ((JSONValue as TJSONArray).Items[i] as TJSonObject).Get('name').JSONValue.Value;
  stringgrid1.Cells[1,j] := id;
Delphi-Quellcode:
for i := 0 to JSonArray.Count - 1 do
begin
  JsonValue := TJsonValue.ParseJSONValue(st);
  if (JSONValue is TJSONArray) then
  begin
    id := ((JSONValue as TJSONArray).Items[i] as TJSonObject).Get('id').JSONValue.Value;
    name := ((JSONValue as TJSONArray).Items[i] as TJSonObject).Get('name').JSONValue.Value;
    stringgrid1.Cells[1,j] := id;
  end;
Was fällt dir auf?


Delphi-Quellcode:
for i := 0 to JSonArray.Count - 1 do
begin
  JsonValue := TJsonValue.ParseJSONValue(st);
  try
    if (JSONValue is TJSONArray) then
    begin
      id := ((JSONValue as TJSONArray).Items[i] as TJSonObject).Get('id').JSONValue.Value;
      name := ((JSONValue as TJSONArray).Items[i] as TJSonObject).Get('name').JSONValue.Value;
      stringgrid1.Cells[1,j] := id;
    end;
  finally
    JsonValue.Free;
  end;
Tipp: Füge mal ein ReportMemoryLeaksOnShutdown := True; in deine DPR oder ins OnCreate deiner Form ein.




Anzahl = Count
Bereich = 0 bis Anzahl-1 oder 1 bis Anzahl

10 = 0 bis 9 (0 1 2 3 4 5 6 7 8 9 = 10 Zahlen)
oder
10 = 1 bis 10 (1 2 3 4 5 6 7 8 9 10 = auch 10 Zahlen)
wenn bei 1 begonnen wird zu zählen

oder
10 = 99998 bis 100007
Ein Therapeut entspricht 1024 Gigapeut.

Geändert von himitsu (20. Sep 2024 um 09:04 Uhr)
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 13:23 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz