#1 2019-10-10 10:38:32

ertank
Member
Registered: 2016-03-16
Posts: 168

Empty sub-json in a json

Hello,

I just realize now that I need to serialize something like an empty json:

      "pageTemplate":"1",
      "description":"Kodak Z915 Fotograf Makinesi 10Mp 50X zoom",
      "startdate":{
  
      },
      "catalogId":{
  
      },
      "catalogDetail":{
  
      },
      "format":"S",
      "startPrice":{
  
      },
      "buyNowPrice":"240",
      "netEarning":{
  
      },
      "listingDays":"30",

Above, startdate, catalogId, catalogDetail, startPrice, netEarning are all what I call empty json. For the record, above example is part of a bigger json string.

My understanding from the documentation of the web service is that. I will never have the need to fill inside of startdate, catalogId etc.

I am not sure if mORMot can do that and how to serialize something like above with mORMot.

Any help is appeciated.

Thanks & regards,
Ertan

Offline

#2 2019-10-10 10:50:06

ertank
Member
Registered: 2016-03-16
Posts: 168

Re: Empty sub-json in a json

I was wrong. It seems I also need to de-serialize such json data. Another problem might be that Sometimes they won't be empty at all. Example response from web service documentation:

{
   "ackCode":"success",
   "responseTime":"10/11/2010 11:51:11",
   "timeElapsed":"1369 ms",
   "sales":{
      "sale":{
         "saleCode":"325479960001",
         "status":"Alıcı ürüne onay verdi",
         "productId":"32547996",
         "productTitle":"Fotograf makinesi için çanta",
         "price":"1",
         "cargoPayment":"Alıcı öder",
         "amount":"1",
         "endDate":"09/11/2010 15:30:08",
         "buyerInfo":{
            "username":"test_user2",
            "name":"Mehmet",
            "surname":"Yılmaz",
            "phone":"212 3456435",
            "address":"Eski Üsküdar Yolu Cad. Çayıryolu Sok. No:1 Partaş Center K:16",
            "district":{
 
            },
            "city":"İstanbul",
            "zipCode":{
 
            }
         },
         "thumbImageLink":"http://mcdn01.gittigidiyor.net/3254/tn9/32547996_tn9_0.jpg",
         "lastActionDate":"09/11/2010 15:38:55"
      }
   }
}

Above, district, zipCode are empty, but it is not always empty.

I am searching for an example where at least one of them is not empty, but so far failed to find one.

Offline

Board footer

Powered by FluxBB