- Alfredo Santibanez
- PowerBuilder
- Tuesday, 4 February 2020 05:16 PM UTC
Hi,
I am trying to read data records returned from a web service in json format. It contains a complex structure and starts as an array. Please find bellow a sample text.
I need to read all records and from each record find some values.
ls_Error = lnv_package.LoadString(ls_html) does not work, it returns
"Failed to load the JSON data because its root node is not an object"
I am using:
ls_Error = lnv_JsonParser.LoadString(ls_html)
if Len(ls_Error) > 0 then
MessageBox("Error", ls_Error)
end if
ll_RootObject = lnv_JsonParser.GetRootItem()
ll_ChildCount = lnv_JsonParser.GetChildCount(ll_RootObject)
// Obtains the values of child items
for ll_Index = 1 to ll_ChildCount
ls_key = lnv_JsonParser.GetChildKey(ll_RootObject, ll_Index)
next
The child count is correct, but ls_key is always ""
I need the first field "uuid" and then find some others.
Any ideas?
REgards
Alfredo Santibáñez
DATA SAMPLE
[{"uuid":"8e9cca46-21a2-11ea-a945-0242c0a8b008","mdmVersion":1,"links":[{"rel":"self","href":"https://sbox.edwh.nkg.net/mdm/rest/trade/businesspartner/businessthirdparties/8e9cca46-21a2-11ea-a945-0242c0a8b008"},{"rel":"self immutable","href":"https://sbox.edwh.nkg.net/mdm/rest/trade/businesspartner/businessthirdparties/8e9cca46-21a2-11ea-a945-0242c0a8b008/versions/1"}],"identificationCounter":1,"legalName":"Julio Avel Valqui Gomez","commercialName":"Julio Avel Valqui Gomez","acronym":"PE-20006945","addresses":[],"commercialIds":[],"taxIds":[],"internationalStandardCertifications":[],"productCertifications":[],"complianceRating":{"uuid":"8e9cf158-21a2-11ea-a945-0242c0a8b008","mdmVersion":1,"dateOfRating":"2019-01-01","complianceRatingTypeMD":{"uuid":"67fe80c1-edc9-42b0-818e-12d07268dba7","mdmVersion":0,"links":[{"rel":"self","href":"https://sbox.edwh.nkg.net/mdm/rest/compliance/complianceratingtypes/67fe80c1-edc9-42b0-818e-12d07268dba7"},{"rel":"self immutable","href":"https://sbox.edwh.nkg.net/mdm/rest/compliance/complianceratingtypes/67fe80c1-edc9-42b0-818e-12d07268dba7/versions/0"}],"code":"APPROVED","description":"Approved"}},"priceFixationTerms":[],"businessThirdPartyReferenceIds":[],"legalCountryMD":{"uuid":"bcdf1600-7a27-11e8-b8b2-0242ac120006","mdmVersion":1,"links":[{"rel":"self","href":"https://sbox.edwh.nkg.net/mdm/rest/foundation/locations/bcdf1600-7a27-11e8-b8b2-0242ac120006"},{"rel":"self immutable","href":"https://sbox.edwh.nkg.net/mdm/rest/foundation/locations/bcdf1600-7a27-11e8-b8b2-0242ac120006/versions/1"}],"name":"PERU","unLocode":"PE","countryCode":"PE","functions":[]},"businessTypeMD":{"uuid":"a66316f7-9ef4-11e7-be27-00ff0b1c94f7","mdmVersion":0,"links":[{"rel":"self","href":"https://sbox.edwh.nkg.net/mdm/rest/trade/businesspartner/organisationtypes/a66316f7-9ef4-11e7-be27-00ff0b1c94f7"},{"rel":"self immutable","href":"https://sbox.edwh.nkg.net/mdm/rest/trade/businesspartner/organisationtypes/a66316f7-9ef4-11e7-be27-00ff0b1c94f7/versions/0"}],"code":"SP","description":"Sole Proprietorship","category":"Sole Proprietorship","businessThirdPartyMandatory":{"uuid":"a66316f7-9ef4-11e7-be27-00ff0b1c94f7","mdmVersion":0,"checkOwner":false,"checkUltimateBeneficiaryOwner":false,"checkRepresentative":false,"checkContactPerson":false}},"ownersMD":[{"uuid":"2182a1aa-20e5-11ea-a945-0242c0a8b008","mdmVersion":1,"links":[{"rel":"self","href":"https://sbox.edwh.nkg.net/mdm/rest/foundation/individuals/2182a1aa-20e5-11ea-a945-0242c0a8b008"},{"rel":"self immutable","href":"https://sbox.edwh.nkg.net/mdm/rest/foundation/individuals/2182a1aa-20e5-11ea-a945-0242c0a8b008/versions/1"}],"firstName":"Julio Avel","lastName":"Valqui Gomez","identificationCounter":1,"addressingForm":"Mr","personalIdNumber":"PE-20006945","contacts":[],"citizenshipMD":{"uuid":"bcdf1600-7a27-11e8-b8b2-0242ac120006","mdmVersion":1,"links":[{"rel":"self","href":"https://sbox.edwh.nkg.net/mdm/rest/foundation/locations/bcdf1600-7a27-11e8-b8b2-0242ac120006"},{"rel":"self immutable","href":"https://sbox.edwh.nkg.net/mdm/rest/foundation/locations/bcdf1600-7a27-11e8-b8b2-0242ac120006/versions/1"}],"name":"PERU","unLocode":"PE","countryCode":"PE","functions":[]},"identificationTypeMD":{"uuid":"a775143d-db0f-4533-b965-239e58ae43d3","mdmVersion":0,"links":[{"rel":"self","href":"https://sbox.edwh.nkg.net/mdm/rest/foundation/identificationtypes/a775143d-db0f-4533-b965-239e58ae43d3"},{"rel":"self immutable","href":"https://sbox.edwh.nkg.net/mdm/rest/foundation/identificationtypes/a775143d-db0f-4533-b965-239e58ae43d3/versions/0"}],"code":"IC","description":"Identification Card"}}],"thirdPartyTypesMD":[{"uuid":"4f1d0521-9ef4-11e7-b90a-00ff0b1c94f7","mdmVersion":0,"links":[{"rel":"self","href":"https://sbox.edwh.nkg.net/mdm/rest/trade/businesspartner/thirdpartytypes/4f1d0521-9ef4-11e7-b90a-00ff0b1c94f7"},{"rel":"self immutable","href":"https://sbox.edwh.nkg.net/mdm/rest/trade/businesspartner/thirdpartytypes/4f1d0521-9ef4-11e7-b90a-00ff0b1c94f7/versions/0"}],"code":"CS-P","description":"Coffee Supplier – Producer","category":"Coffee Supplier"}],"presentationOfDocumentsMD":{"uuid":"a667d204-9ef4-11e7-be27-00ff0b1c94f7","mdmVersion":0,"links":[{"rel":"self","href":"https://sbox.edwh.nkg.net/mdm/rest/trade/businesspartner/presentationofdocuments/a667d204-9ef4-11e7-be27-00ff0b1c94f7"},{"rel":"self immutable","href":"https://sbox.edwh.nkg.net/mdm/rest/trade/businesspartner/presentationofdocuments/a667d204-9ef4-11e7-be27-00ff0b1c94f7/versions/0"}],"code":"BANK","description":"Via Bank"},"paymentTermMD":{"uuid":"a6789b4a-9ef4-11e7-be27-00ff0b1c94f7","mdmVersion":0,"links":[{"rel":"self","href":"https://sbox.edwh.nkg.net/mdm/rest/trade/paymentterms/a6789b4a-9ef4-11e7-be27-00ff0b1c94f7"},{"rel":"self immutable","href":"https://sbox.edwh.nkg.net/mdm/rest/trade/paymentterms/a6789b4a-9ef4-11e7-be27-00ff0b1c94f7/versions/0"}],"code":"CAD","description":"Cash Against presentation of documents","viaBank":false}},{"uuid":"a8bfec86-21a2-11ea-a945-0242c0a8b008","mdmVersion":1,"links":[{"rel":"self","href":"https://sbox.edwh.nkg.net/mdm/rest/trade/businesspartner/businessthirdparties/a8bfec86-21a2-11ea-a945-0242c0a8b008"},{"rel":"self immutable","href":"https://sbox.edwh.nkg.net/mdm/rest/trade/businesspartner/businessthirdparties/a8bfec86-21a2-11ea-a945-0242c0a8b008/versions/1"}],"identificationCounter":2,"legalName":"Julio Avel Valqui Gomez","commercialName":"Julio Avel Valqui Gomez","acronym":"PE-20006945","addresses":[],"commercialIds":[],"taxIds":[],"internationalStandardCertifications":[],"productCertifications":[],"complianceRating":{"uuid":"a8c01398-21a2-11ea-a945-0242c0a8b008","mdmVersion":1,"dateOfRating":"2019-01-01","complianceRatingTypeMD":{"uuid":"67fe80c1-edc9-42b0-818e-12d07268dba7","mdmVersion":0,"links":[{"rel":"self","href":"https://sbox.edwh.nkg.net/mdm/rest/compliance/complianceratingtypes/67fe80c1-edc9-42b0-818e-12d07268dba7"},{"rel":"self immutable","href":"https://sbox.edwh.nkg.net/mdm/rest/compliance/complianceratingtypes/67fe80c1-edc9-42b0-818e-12d07268dba7/versions/0"}],"code":"APPROVED","description":"Approved"}},"priceFixationTerms":[],"businessThirdPartyReferenceIds":[],"legalCountryMD":{"uuid":"bcdf1600-7a27-11e8-b8b2-0242ac120006","mdmVersion":1,"links":[{"rel":"self","href":"https://sbox.edwh.nkg.net/mdm/rest/foundation/locations/bcdf1600-7a27-11e8-b8b2-0242ac120006"},{"rel":"self immutable","href":"https://sbox.edwh.nkg.net/mdm/rest/foundation/locations/bcdf1600-7a27-11e8-b8b2-0242ac120006/versions/1"}],"name":"PERU","unLocode":"PE","countryCode":"PE","functions":[]},"businessTypeMD":{"uuid":"a66316f7-9ef4-11e7-be27-00ff0b1c94f7","mdmVersion":0,"links":[{"rel":"self","href":"https://sbox.edwh.nkg.net/mdm/rest/trade/businesspartner/organisationtypes/a66316f7-9ef4-11e7-be27-00ff0b1c94f7"},{"rel":"self immutable","href":"https://sbox.edwh.nkg.net/mdm/rest/trade/businesspartner/organisationtypes/a66316f7-9ef4-11e7-be27-00ff0b1c94f7/versions/0"}],"code":"SP","description":"Sole Proprietorship","category":"Sole Proprietorship","businessThirdPartyMandatory":{"uuid":"a66316f7-9ef4-11e7-be27-00ff0b1c94f7","mdmVersion":0,"checkOwner":false,"checkUltimateBeneficiaryOwner":false,"checkRepresentative":false,"checkContactPerson":false}},"ownersMD":[{"uuid":"282fc3ea-20e5-11ea-a945-0242c0a8b008","mdmVersion":1,"links":[{"rel":"self","href":"https://sbox.edwh.nkg.net/mdm/rest/foundation/individuals/282fc3ea-20e5-11ea-a945-0242c0a8b008"},{"rel":"self immutable","href":"https://sbox.edwh.nkg.net/mdm/rest/foundation/individuals/282fc3ea-20e5-11ea-a945-0242c0a8b008/versions/1"}],"firstName":"Julio Avel","lastName":"Valqui Gomez","identificationCounter":2,"addressingForm":"Mr","personalIdNumber":"PE-20007921","contacts":[],"citizenshipMD":{"uuid":"bcdf1600-7a27-11e8-b8b2-0242ac120006","mdmVersion":1,"links":[{"rel":"self","href":"https://sbox.edwh.nkg.net/mdm/rest/foundation/locations/bcdf1600-7a27-11e8-b8b2-0242ac120006"},{"rel":"self immutable","href":"https://sbox.edwh.nkg.net/mdm/rest/foundation/locations/bcdf1600-7a27-11e8-b8b2-0242ac120006/versions/1"}],"name":"PERU","unLocode":"PE","countryCode":"PE","functions":[]},"identificationTypeMD":{"uuid":"a775143d-db0f-4533-b965-239e58ae43d3","mdmVersion":0,"links":[{"rel":"self","href":"https://sbox.edwh.nkg.net/mdm/rest/foundation/identificationtypes/a775143d-db0f-4533-b965-239e58ae43d3"},{"rel":"self immutable","href":"https://sbox.edwh.nkg.net/mdm/rest/foundation/identificationtypes/a775143d-db0f-4533-b965-239e58ae43d3/versions/0"}],"code":"IC","description":"Identification Card"}}],"thirdPartyTypesMD":[{"uuid":"4f1d0521-9ef4-11e7-b90a-00ff0b1c94f7","mdmVersion":0,"links":[{"rel":"self","href":"https://sbox.edwh.nkg.net/mdm/rest/trade/businesspartner/thirdpartytypes/4f1d0521-9ef4-11e7-b90a-00ff0b1c94f7"},{"rel":"self immutable","href":"https://sbox.edwh.nkg.net/mdm/rest/trade/businesspartner/thirdpartytypes/4f1d0521-9ef4-11e7-b90a-00ff0b1c94f7/versions/0"}],"code":"CS-P","description":"Coffee Supplier – Producer","category":"Coffee Supplier"}],"presentationOfDocumentsMD":{"uuid":"a667d204-9ef4-11e7-be27-00ff0b1c94f7","mdmVersion":0,"links":[{"rel":"self","href":"https://sbox.edwh.nkg.net/mdm/rest/trade/businesspartner/presentationofdocuments/a667d204-9ef4-11e7-be27-00ff0b1c94f7"},{"rel":"self immutable","href":"https://sbox.edwh.nkg.net/mdm/rest/trade/businesspartner/presentationofdocuments/a667d204-9ef4-11e7-be27-00ff0b1c94f7/versions/0"}],"code":"BANK","description":"Via Bank"},"paymentTermMD":{"uuid":"a6789b4a-9ef4-11e7-be27-00ff0b1c94f7","mdmVersion":0,"links":[{"rel":"self","href":"https://sbox.edwh.nkg.net/mdm/rest/trade/paymentterms/a6789b4a-9ef4-11e7-be27-00ff0b1c94f7"},{"rel":"self immutable","href":"https://sbox.edwh.nkg.net/mdm/rest/trade/paymentterms/a6789b4a-9ef4-11e7-be27-00ff0b1c94f7/versions/0"}],"code":"CAD","description":"Cash Against presentation of documents","viaBank":false}}]
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.