|
|
|
|
|
The following example uses JSON serialization. // Structure to transform into JSON ST_Product is Structure // <Serialize> allows you to have a different name in JSON sName is string <Serialize ="ProductName"> nID is int nQty is int mValue is currency <Serialize ="Amount"> END ST_Person is Structure sLastName is string <Serialize ="LastName"> sFirstName is string <Serialize ="FirstName"> dDOB is Date arrProducts is array of ST_Product END arrPersons is array of ST_Person // Fill the data nPersonIndex is int nProductIndex is int nPersonIndex = ArrayAdd(arrPersons) arrPersons[nPersonIndex].sLastName = "Doe" arrPersons[nPersonIndex].sFirstName = "John" arrPersons[nPersonIndex].dDOB = "19880516" nProductIndex = ArrayAdd(arrPersons[nPersonIndex].arrProducts) arrPersons[nPersonIndex].arrProducts[nProductIndex].mValue = 89.9 arrPersons[nPersonIndex].arrProducts[nProductIndex].nID = 12345724 arrPersons[nPersonIndex].arrProducts[nProductIndex].nQty = 5 arrPersons[nPersonIndex].arrProducts[nProductIndex].sName = "Red jacket" // Retrieve the JSON code bufJson is Buffer Serialize(arrPersons.bufJson, psdJSON //[ { // "LastName":"Doe", // "FirstName":"John", // "dDOB":"1988-05-16", // "arrProducts":[ { // "ProductName":"Red jacket", // "nID":12345724, // "nQty":5, // "Amount":89.9 // } ] // } ] // Send the JSON to a site by POST HTTPCreateForm("JSONForm") HTTPAddParameter("JSONForm", "JSONPERSON", bufJson) HTTPSendForm("JSONForm", ... "http://MySite/MySite_WEB/US/PAGE_Persons.awp", httpPost)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|