I extracted a little bit of my code to create a JSON object. This code works on Universe and Unidata. Unidata you will need to switch includes.
SUBROUTINE UDOSub(PARAM1,PARAM2,RETURN.ID) * PARAM1 - Field Names separated by field marks * PARAM2 - Data separated by field marks ************************************************ * x8UD $INCLUDE INCLUDE UDO.H ; * x8UD $INCLUDE UNIVERSE.INCLUDE UDO.H ; * x8UV rtn = UDOCreate(UDO_OBJECT,udoObj) ; * Create handle IF rtn # 0 THEN RETURN.ID = "~Unable to create UDO object ":rtn ; RETURN MAX.FM = DCOUNT(PARAM1,@FM) FOR X = 1 TO MAX.FM NAME = PARAM1<X> VALUE = PARAM2<X> rtn = UDOSetProperty(udoObj, NAME, VALUE) ; * Load Object IF rtn # 0 THEN RETURN.ID = "~Unable to setProperty ":rtn:" on ":NAME ; RETURN NEXT X rtn = UDOWrite(udoObj, UDOFORMAT_JSON, json) ; * Write to variable json IF rtn # 0 THEN RETURN.ID = "~Unable to write UDO ":rtn ; RETURN rtn = UDOFree(udoObj) ; * Release memory IF rtn # 0 THEN RETURN.ID = "~Unable to free UDO ":rtn ; RETURN json = CONVERT(CHAR(9):CHAR(10),"",json) ; * Remove tabs and carriage returns RETURN.ID = "[":json:"]" ; * Make it an array END Regards, Doug www.u2logic.com/applications.html _______________________________________________ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users