[WM] - How to extract Array from JSON? April 08, 2019 02:21PM |
Registered: 5 years ago Posts: 151 |
[{"allowed_uoms":[399,268],"categ_id":[180,"C-PVC 45\u00b0 ELBOW"],"discount_value":55.0,"id":384,"list_price":8.1,"name":"\u00be\"","size_in_mm":0.0,"uom_data":[{"factor_inv":300.0,"id":399,"name":"BIG Pack Of 300"}]},{"allowed_uoms":[403,240],"categ_id":[180,"C-PVC 45\u00b0 ELBOW"],"discount_value":55.0,"id":385,"list_price":15.75,"name":"1\"","size_in_mm":0.0,"uom_data":[{"factor_inv":160.0,"id":403,"name":"BIG Pack Of 160"}]},{"allowed_uoms":[395,264],"categ_id":[180,"C-PVC 45\u00b0 ELBOW"],"discount_value":55.0,"id":386,"list_price":22.5,"name":"1\u00bc\"","size_in_mm":0.0,"uom_data":[{"factor_inv":80.0,"id":395,"name":"BIG Pack Of 80"}]}]
Re: [WM] - How to extract Array from JSON? April 08, 2019 04:45PM |
Registered: 5 years ago Posts: 297 |
Re: [WM] - How to extract Array from JSON? April 08, 2019 07:00PM |
Registered: 5 years ago Posts: 151 |
vData is variant = JSONToVariant(jsonString) nCount is int = vData.allowed_uoms..Occurrence //will let you know how many items you are working with then to read it for r = 1 to nCount value = vData.allowed_uoms[r].discount_value //Nested array nCntNest is int = vData.allowed_uoms[r].uom_data..Occurrence for e to nCntNest NestedValue = vData.allowed_uoms[r].uom_data[e].factor_inv End End
Re: [WM] - How to extract Array from JSON? April 08, 2019 07:05PM |
Registered: 5 years ago Posts: 151 |
FOR EACH v OF JZ nProdID = v.id..Value sProdName = v.name..Value Info(v.uom_data..Type) //<= this show type of variable to be 142 which is not listed anywhere on this page: [doc.windev.com] FOR EACH X OF v.uom_data..member //<== Get error here sProdPacking = X..Value END cyProdRate = v.list_price..Value rProdDIscount = v.discount_value..Value nProdQty = 0 END
Re: [WM] - How to extract Array from JSON? April 08, 2019 07:56PM |
Registered: 5 years ago Posts: 151 |
FOR EACH v OF JZ nProdID = v.id..Value sProdName = v.name..Value sProdPacking = v.uom_data[1].factor_inv nUomID = v.uom_data[1].id cyProdRate = v.list_price..Value rProdDIscount = v.discount_value..Value nProdQty = 0 //Will be entered buy Users END