Delphi Can
Rest.JSON array serilize hk - Baskı Önizleme

+- Delphi Can (https://www.delphican.com)
+-- Forum: Delphi (https://www.delphican.com/forumdisplay.php?fid=3)
+--- Forum: Genel Programlama (https://www.delphican.com/forumdisplay.php?fid=6)
+--- Konu Başlığı: Rest.JSON array serilize hk (/showthread.php?tid=7945)

Sayfalar: 1 2


Cvp: Rest.JSON array serilize hk - yhackup - 28-11-2024

Onunla ilgili değil, siz kendinizin oluşturduğu jsonu parse ediyorsunuz. Kendisi de array değil obje oluşturuyor.  o yüzden parse ederken "The input value is not a valid Object." diyor haklı olarak.


Sizin kodun oluşturduğu json ile benim parse etmem gereken json farkı

2024-11-28-09-06-28.jpg


Cvp: Rest.JSON array serilize hk - delphi.developer - 28-11-2024

TJSON sınıfı metodları dönüşüm için her halükarda JSON Objesini referans alıyor. Bu durumda, JSON dizisini elde edebilmek için aşağıdaki gibi birbirine alternatif kod blokları kullanılabilir.
var JObj := TJSONArray(TJSON.ObjectToJsonObject(Cells, [joIndentCasePreserve]).Pairs[0].JsonValue);
var JObj := TJSON.ObjectToJsonObject(Cells, [joIndentCasePreserve]).GetValue<TJSONArray>('ItemsArray');