[Stackoverflow] [Progress OpenEdge ABL] how can I override the toString method in openedge?

Status
Not open for further replies.
R

Renzo Ramos

Guest
I have a serializable class that I would like to provide my own toString when being serialized to JSON.

Code:
    DEFINE PUBLIC PROPERTY address1 AS CHARACTER NO-UNDO 
    GET.
    SET.
    
    METHOD PUBLIC OVERRIDE CHARACTER toString(  ):
        
        DEFINE VARIABLE result AS CHARACTER NO-UNDO.

        RETURN address1 + address2 + city + country.

    END METHOD.

END CLASS. ```

I am also assigning the class to a temptable and using the write-json method of a dataset to output but I get the standard toString representation .."myClass": {
                "prods:objId": 1,
                "myClass": {
                    "address1": "xxxxx"
                }
            } 

can I somehow override the toString being used ?

Continue reading...
 
Status
Not open for further replies.
Top