JsonToString

 

The JsonToString function converts a JSON object to a string.

 

string @JsonToString(string objectId);

 

Parameters

string objectId   : Target JSON object ID

  

Return Values

Return JSON string on success

Return an empty string on failure

 

Example 1)

// Add nested objects
string addressId = @JsonStructNew("{}");
@JsonSet(addressId, "city", "Seoul", "string");
@JsonSet(addressId, "zipCode", "12345", "string");
@JsonSet(jsonObjectId, "address", addressId, "");

string jsonObjectId = @JsonStructNew("{}");
@JsonSet(jsonObjectId, "name", "John", "string");
@JsonSet(jsonObjectId, "age", 30, "int");

// Convert to JSON String
string jsonString = @JsonToString(jsonObjectId);
// Result : {"name":"John","age":30}

 

Version information

Supported Version: 10.3.6.25 or later

 

Related Helps)

JsonStructNew

JsonAppend

JsonSet

JsonToString

JsonClear

JsonGet

JsonFromString

JsonSetValue

JsonGetValue

JsonClearAll

JsonStringGetValue

JsonStringSetValue

JsonTemplateLoad

JsonTemplateReplacePlaceholder

JsonTemplateReplaceDone

JsonTemplateReplaceMissing

JsonTemplateTagSet