JsonGet

 

The JsonGet function retrieves a specific key value from a JSON object.

 

string @JsonGet(string objectId, string key);

 

Parameters

string objectId   : Target JSON object ID

string key         : Key name to search for

  

Return Values

Return JSON object ID on success

Return an empty string on failure

 

 

Example 1)

string jsonObject = @JsonStructNew("{}");
@JsonSet(jsonObject, "user", "Administrator", "string");
@JsonSet(jsonObject, "level", 5, "int");

// Get the value of the "user" key
string userKey = @JsonGet(jsonObject, "user");
string userValue = @JsonToString(userKey);
// Result: "Administrator"

 

 

Example 2)

string personId = @JsonStructNew("{}");
@JsonSet(personId, "name", "John", "string");

string addressId = @JsonStructNew("{}");
@JsonSet(addressId, "city", "Seoul", "string");
@JsonSet(personId, "address", addressId, "");

// Get the address object
string extractedAddressId = @JsonGet(personId, "address");
// Get the city value from the extracted object
string cityValue = @JsonGetValue(extractedAddressId, "city");

 

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