Burada bulunan jsondaki itemname i almak istiyorum ve jsonarraya json ile atama yapmak istiyorum.
Örnek olarak çalıştıramadığım kod
var Arr : TCLJSONArray; { Arr = TCLJSONArray.Create; Arr = TCLJSONArray.CreateFromJSON('{"order_id": 30,"table_name": "K12","order_time": "17:57 13.11.2025","status": "Pending","note": "Please make one of the kebabs extra spicy.","grand_total": 398,"items": [{"item_id": 2,"item_name": "kebap","amount": 2,"unit_price": 123,"total_price": 246},{"item_id": 4,"item_name": "Izgara piliç","amount": 1,"unit_price": 76,"total_price": 76},{"item_id": 7,"item_name": "Izgara kanat","amount": 1,"unit_price": 76,"total_price": 76}]}');
ShowMessage(Arr.ToJSONString); } Asıl yapmak istediğim ise Burada invalid type cast hatasını gidermek istiyorum. void GetOrderDetailsCompletedV(Sender) var Arr : TCLJSONArray; restObj: TCLRest; responseLength: Integer; FQry: TCLJSONQuery; { Try restObj = TCLRest(Sender); if (restObj == nil) { ShowMessage(' HATA: Sender nil! Response alınamadı!'); Exit; } JsonResponse = restObj.Response; responseLength = Length(JsonResponse); if (responseLength == 0) { ShowMessage('️ UYARI: Response boş! (0 karakter)'); ShowMessage('query is Served (boş response)'); Exit; }/* If (responseLength > 50){ jsonOutput = Copy(JsonResponse, 1, 50) + '...' + JsonResponse; } ShowMessage(' restObj Response: ' + jsonOutput);*/ FQry = TCLJSONQuery.Create(nil); FQry = Clomosy.ClDataSetFromJSON(JsonResponse); Arr = TCLJSONArray.Create; Try Arr = TCLJSONArray.CreateFromJSON(JsonResponse); ShowMessage(JsonResponse); ShowMessage(Arr.ToJSONString); if ((Arr == nil) || (Arr.Count == 0)) { ShowMessage('JSON Array boş!'); ShowMessage('query is Served (boş array)'); Exit; } noteMemo.Text = Clomosy.CLParseJSON(JsonResponse, '0.note'); AmountValueLbl.Text = Clomosy.CLParseJSON(JsonResponse, '0.grand_total') + 'TL'; DisplayArrivalTime.Text = Clomosy.CLParseJSON(JsonResponse, '0.order_time'); DetailsPnlV(FQry); finally if (Arr <> nil) { Arr.Free; Arr = nil; } //ShowMessage(' query is Served (başarılı)'); } except ShowMessage(' Hata: ' + LastExceptionMessage); } } https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" rel="nofollow - https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">
|