ToJson Method

Official Content
This documentation is valid for:

Returns a string with the JSON representation for the Structured Data Type (SDT) object or Business Component variable. 

Syntax

&String = &Vble.ToJson([&Boolean])

Where:

&String
    Attribute or variable based on the Character data type.
 
&Vble
    Variable based on an SDT or Business Component.
 
&Boolean
     Optional parameter: It only applies to Business Component variables. If True, then the returned string contains the auxiliary variables (old values, mode, initialized flag). Otherwise, it only contains the record data. The default value is True.

Sample

Given the following SDT:

CountrySDT

The result is:

{
    "Name" : "Uruguay",
    "Language" : "Spanish",
    "Coordinates" : 
        {
         "Latitude" : 30,
         "Longitude": 35,
	},
    "Cities" : ["Montevideo", "Paysandu" ]
}

Scope

Generators: .NET Generator.NETJava


See Also

FromJson Method
Structured Data Type (SDT) object