Working with your sample, I came very close to a solution.
This program will read the data and even the subdata (arrays that are in fields) are seen and this data i can see.
I found a link to the Harbour functions, but failt to make a array with all the possible fieldnames and data.
As you see, the building of the aFields is not working. What is needed for this ? Maybe the approich is also not optimal...
#include "FiveWin.ch"
Function Main()
local oWnd, oActiveX1, oActiveX2, cTemp
DEFINE WINDOW oWnd TITLE "FiveWin multiple ActiveX support"
@ 9,5 BUTTON "&Hash" OF oWnd SIZE 40, 20 ACTION TestHash()
ACTIVATE WINDOW oWnd
return nil
//----------------------------------------------------------------------------//
Function TestHash()
local hDatos := { => }
local aTest := {}
local aResult := {}
local aFields := {}
local uResponse, cCookies, I
uResponse := '{"uprid":"2550","productId":"2550","stockId":"-1","referenceId":"0","isBundle":"0","bundledProducts":"[]","status":"1","quantity":"0","maximumQuantity":"null","ean":"98745123456","sku":"skuData","model":"APITEST","hsCode":"","name":"Noyca","price":"0.0000","taxClassId":"3","taxRate":"21.0000","isPhysical":"1","isDigital":"0","isQuotation":"0","url":"onderhoud\/api-test","urlAbs":"https:\/\/<!-- m --><a class="postlink" href="http://www.maveco-webshop.be">http://www.maveco-webshop.be</a><!-- m -->\/onderhoud\/api-test","attributesString":"","backOrder":0,"onHome":0,"layover":0,"configurationAllowCheckout":0,"configurationStockCheck":0,"attributes":[],"description":"Memo<b>Data<\/b>","addonInstagramEnabled":"0","addonInstagram":"0","addonOcsEnabled":"0","dateAdded":"2021-10-30 18:40:57","lastModified":"2021-10-30 19:17:39","descriptions":{"description":"Memo<b>Data<\/b>","extra":"","intro":""},"images":["5101000.jpg","","","","","","","","","","",""],"image_alt":["","","","","","","","","","","",""],"discounts":{"name":"0","groupDiscount":"0.00","groupDiscountCategory":"0.00","groupDiscountProduct":"0.00"},"category":{"id":"888982","name":"Onderhoud","categoryIds":"888982","cPath":"888982"},"quantities":{"quantity":"0","physicalQuantity":"0","minimumQuantity":"0","maximumQuantity":null,"externalQuantity":"0","quantityStep":"1","trackQuantity":"1"},"prices":{"basePrice":"0.0000","normalPrice":"0.0000","price":"0.0000","specialPrice":"0.0000","purchasePrice":"0.0000"},"manufacturer":{"id":0,"name":"","image":""},"dimensions":{"type":"0","width":0,"height":0,"area":0,"weight":0},"reviews":{"count":0,"avg":0},"resources":[],"addons":{"multicatalog":{"enabled":false},"layover":{"enabled":true}}}'
hb_JsonDecode( uResponse, @hDatos ) // -> Hash
XBrowse( hb_hKeys( hDatos ) ) // -> Array
XBrowse( hb_hValues( hDatos ) ) // -> Array
XBrowse( hDatos )
// simple key
cCookies := If( hb_HHasKey( hDatos, "name" ), hb_hGet( hDatos, "name" ), "Not Found" )
msginfo(cCookies) // Found
// complex key a array insite a field // "prices":{"basePrice":"0.0000","normalPrice":"0.0000","price":"0.0000","specialPrice":"0.0000","purchasePrice":"0.0000"}
// Extract 1 complex key if the keyname is known
if hb_HHasKey( hDatos, "prices" )
msginfo("Found")
XBrowse( hb_hKeys( hDatos["prices"] ) ) // is showing the items insite the sub array
XBrowse( hb_hValues (hDatos["prices"] ) ) // -> Array
XBrowse( hDatos["prices"] ) // Items and Values subarray
// At this point, I could stuff the data insite a dbf. I have fields and values
else
msginfo("Not Found")
endif
// extract all keys, not knowing if there are subarray (keys)
aTest = hb_hKeys( hDatos ) // -> Array
xbrowse(aTest)
for i = 1 to len(aTest)
cZoek = aTest[i]
msginfo(cZoek)
if hb_HHasKey( hDatos, cZoek )
aResult = hDatos[cZoek] // -> Array
XBrowse( aResult ) // is showing the items, also the subitems
// Here I want to build a array (aFields) with all the keys that are seen, with there values.
// not working
for m = 1 to len(aResult)
aadd(aFields,aResult[m])
next m
//XBrowse( aResult ) // is showing the items insite the sub array
endif
//XBrowse( aFields ) // is showing the items insite the sub array
// Build the dbf with the array.
// Maybe better to build a single Hash with all fields. Than a hashtodbf save can be done.
next
Return nil