![]() |
|
Json Array Oluşturma - Baskı Önizleme +- Delphi Can (https://www.delphican.com) +-- Forum: Delphi (https://www.delphican.com/forumdisplay.php?fid=3) +--- Forum: Mobil Platform - FireMonkey (FMX) (https://www.delphican.com/forumdisplay.php?fid=7) +--- Konu Başlığı: Json Array Oluşturma (/showthread.php?tid=6936) |
Json Array Oluşturma - MirDurmaz - 19-09-2022 Merhaba, Benim oluşturmak istediğim json örneği: {
"registration_ids" : [
"crX7c-FfQXunMB5dqo"
],
"notification" : {
"title": "Hi",
"body" : "Notification test"
}
}
Bu örnek de benim oluşturamadığım yer resgistration_ids isimli diziye elemanları namesiz oluşturmam gerekiyor ama bunu bir türlü başaramadım. İçini boş bırakttiğimda karşı taraf kabul etmiyor.Yardımcı olabilir misiniz ? wrtJSON.Formatting := TJsonFormatting.Indented;
wrtJson.WriteStartObject;
wrtJson.WritePropertyName('registration_ids');
wrtJson.WriteStartArray;
wrtJson.WriteStartObject;
wrtJson.WritePropertyName('');
wrtJson.WriteValue(strToken);
wrtJson.WriteEndObject;
wrtJson.WriteEndArray;
wrtJson.WritePropertyName('notification');
wrtJSON.WriteStartObject;
wrtJSon.WritePropertyName('title');
wrtJson.WriteValue(edtBaslik.Text);
wrtJson.WritePropertyName('body');
wrtJson.WriteValue(edtMesaj.Text);
wrtJSON.WriteEndObject;
wrtJSON.WriteEndObject;
Bu kod ile oluşan Json örneği: {
"registration_ids": [
{
"": "crX7c-FfQXunMB5dqoaaUM:APA91bHOuvOioxEjciJS9V04g9"
],
"notification": {
"title": "Hello",
"body": "Delphi"
}
}
Cvp: Json Array Oluşturma - RAD Coder - 19-09-2022 [attachment=2161] Cvp: Json Array Oluşturma - MirDurmaz - 19-09-2022 Çok Teşekkürler |