West Wind Internet and Client Tools
Json deserialization problem
Hello, after deserializing this json using the wwJsonServiceClient class (in Foxpro) the inventory property values ??are empty. I expected the inventory properties to be deserialized as a collection of listed values. Regards, Milan Kotek
{
"search": "GDB4000",
"items": [
{
"sku": "118||GDB4000",
"title": "",
"generic_article_id": "402",
"generic_article_description": "Sada brzdových desticek, kotoucová brzda",
"id_tecdoc_product": "1816",
"id_manufacturer": "118",
"data_supplier_id": "161",
"article_number": "GDB4000",
"post_id": null,
"image": "https://digital-assets.tecalliance.services/images/1600/14c858807d49c425e5de02e0e46ccb04b958d442.jpg",
"is_tecdoc": "1",
"is_fulltext": "0",
"inventory": [
{
"id_price_group": "1",
"post_id": null,
"sku": "118||GDB4000",
"id_manufacturer": "118",
"article_number": "GDB4000",
"currency": "CZK",
"regular_price": "0.00",
"price": "896.00",
"vat_rate": "0",
"availability": "1",
"id_product": "1146673"
},
{
"id_price_group": "2",
"post_id": null,
"sku": "118||GDB4000",
"id_manufacturer": "118",
"article_number": "GDB4000",
"currency": "CZK",
"regular_price": "0.00",
"price": "896.00",
"vat_rate": "0",
"availability": "1",
"id_product": "1146673"
},
{
"id_price_group": "3",
"post_id": null,
"sku": "118||GDB4000",
"id_manufacturer": "118",
"article_number": "GDB4000",
"currency": "CZK",
"regular_price": "0.00",
"price": "896.00",
"vat_rate": "0",
"availability": "1",
"id_product": "1146673"
},
{
"id_price_group": "4",
"post_id": null,
"sku": "118||GDB4000",
"id_manufacturer": "118",
"article_number": "GDB4000",
"currency": "CZK",
"regular_price": "0.00",
"price": "896.00",
"vat_rate": "0",
"availability": "1",
"id_product": "1146673"
}
]
},
{
"sku": "153||38505",
"title": "",
"generic_article_id": "402",
"generic_article_description": "Sada brzdových desticek, kotoucová brzda",
"id_tecdoc_product": "1813",
"id_manufacturer": "153",
"data_supplier_id": "206",
"article_number": "38505",
"post_id": null,
"image": "https://digital-assets.tecalliance.services/images/1600/158c9ee093a73c1adc1b090ecbbbd4f9dcee9883.jpg",
"is_tecdoc": "1",
"is_fulltext": "0",
"inventory": [
{
"id_price_group": "1",
"post_id": null,
"sku": "153||38505",
"id_manufacturer": "153",
"article_number": "38505",
"currency": "CZK",
"regular_price": "0.00",
"price": "692.00",
"vat_rate": "0",
"availability": "1",
"id_product": "1382323"
},
{
"id_price_group": "2",
"post_id": null,
"sku": "153||38505",
"id_manufacturer": "153",
"article_number": "38505",
"currency": "CZK",
"regular_price": "0.00",
"price": "692.00",
"vat_rate": "0",
"availability": "1",
"id_product": "1382323"
},
{
"id_price_group": "3",
"post_id": null,
"sku": "153||38505",
"id_manufacturer": "153",
"article_number": "38505",
"currency": "CZK",
"regular_price": "0.00",
"price": "692.00",
"vat_rate": "0",
"availability": "1",
"id_product": "1382323"
},
{
"id_price_group": "4",
"post_id": null,
"sku": "153||38505",
"id_manufacturer": "153",
"article_number": "38505",
"currency": "CZK",
"regular_price": "0.00",
"price": "692.00",
"vat_rate": "0",
"availability": "1",
"id_product": "1382323"
}
]
}
]
}
with regards, Milan Kotek

Works for me:
loSer = CREATEOBJECT("wwJsonSerializer")
loResult = loSer.Deserialize(lcJson)
? loResult.Items[1].Inventory[1].price
My guess is you're looking at the data in the debugger and the collection doesn't show anything because the debugger won't show any data for collections unless you drill in. Ignore the debugger... only thing you can use there is the .Count
property.
+++ Rick ---
The VFPX Object Explorer is a very helpful tool when you're trying to view collection objects.