util.JSONObject.fromFGL()

util.JSONObject.fromFGL() creates a new JSON object from a RECORD.

Syntax

CALL util.JSONObject.fromFGL(source)

Parameters

source

a RECORD variable from that the JSON object is created

Usage and examples

util.JSONObject.fromFGL() converts the elements of the RECORD into the key:value pairs of the JSON object.

An object newly created by util.JSONObject.fromFGL() must be assigned to a variable of the util.JSONObject datatype.

MAIN
  DEFINE cust_rec RECORD
         cust_num INTEGER,
         cust_name VARCHAR(30),
         order_ids DYNAMIC ARRAY OF INTEGER
         END RECORD
  DEFINE obj util.JSONObject
    
LET cust_rec.cust_num=345
LET cust_rec.cust_name="McMaclum"
LET cust_rec.order_ids[1] =4732
LET cust_rec.order_ids[2] =9834
LET cust_rec.order_ids[3] =2194
    
LET obj=util.JSONObject.fromFGL(cust_rec)
DISPLAY obj.toString()
CALL fgl_getkey()
END MAIN

More details on how 4GL data types are converted into JSON strings are here.

 

 

Contact Us

Privacy Policy

Copyright © 2025 Querix, (UK) Ltd.