/* write-json-tt.p */
{pi-json-parameterVarDefs.i} /* parameter variable definitions */ {pi-write-json-tt.i} /* ttCust definition */ DEFINE VARIABLE httCust AS HANDLE NO-UNDO. DEFINE VARIABLE lReturnValue AS LOGICAL NO-UNDO. httCust = TEMP-TABLE ttCust:HANDLE. FOR EACH Customer WHERE CustNum < 4: CREATE ttCust. BUFFER-COPY Customer TO ttCust. END. ASSIGN cTargetType = "FILE" cFile = "ttCust.json" lFormatted = TRUE cEncoding = ?. lReturnValue = httCust:WRITE-JSON(cTargetType, cFile, lFormatted, cEncoding). |
{"ttCust": [
{ "CustNum": 1, "Country": "USA", "Name": "Lift Tours", "Address": "276 North Drive", "Address2": "", "City": "Burlington", "State": "MA", "PostalCode": "01730", "Contact": "Gloria Shepley", "Phone": "(617) 450-0086", "SalesRep": "HXM", "CreditLimit": 66700.00, "Balance": 903.64, "Terms": "Net30", "Discount": 35, "Comments": "This customer is on credit hold.", "Fax": "", "EmailAddress": "" }, { "CustNum": 2, }, { "CustNum": 3, } ]} |