ContainsKey

Description

Checks if the key name exists. It only checks the key at the first level of the JSON string.

If more than one key with the same name exists, it will only check the first key. Notice that the IgnoreCase property (true by default) determines whether the key name will be matched in a case-sensitive manner.

Applies to

JSONPackage objects

Syntax

objectname.ContainsKey ( Key )

Argument

Description

objectname

The name of the JSONPackage object whose key you want to check.

Key

A string specifying the key name.


Return value

Boolean. Returns true if the key exists and false if the key does not exist. If any argument's value is null, the method returns null.

Examples

This example sets the value for key and then checks if the key exists:

boolean lb_emp, lb_depart
JsonPackage lnv_package
lnv_package = create JsonPackage

// package the data
lnv_package.SetValue("d_employee", dw_employee) 

// lb_emp will return true and lb_depart will return false
lb_emp = lnv_package.ContainsKey("d_employee")
lb_depart = lnv_package.ContainsKey("d_department")

See also

SetValue