util.JSONObject.toString()

 

util.JSONObject.toString() produces a JSON string from the values included in the JSON object.

 

Syntax:

 

util.JSONObject.toString()

 

Usage and examples:

 

util.JSONObject.toString() creates a JSON string from the name:value pairs of the JSON object.

 

example code

MAIN

  DEFINE cust_rec RECORD

           cust_num INTEGER,

           cust_name, address VARCHAR(30)

         END RECORD

  DEFINE obj util.JSONObject

    

    LET cust_rec.cust_num = 75

    LET cust_rec.cust_name = "Ferguson"

    LET cust_rec.address = "12 Marylon Street"

    

    LET obj = util.JSONObject.fromFGL(cust_rec)

    DISPLAY obj.toString()

 

  CALL fgl_getkey()

END MAIN

 

obtained results

 

 

Example programs:

CVS server: client.querix.com

CVS repository: /lycia_doc_examples

User: client

Project: auxiliary_features/json

Program: util_JSONObject_toString

 

Related articles:

util.JSON.stringify()

util.JSONObject.fromFGL()