Skip to content

Latest commit

 

History

History
25 lines (17 loc) · 510 Bytes

key-exists.md

File metadata and controls

25 lines (17 loc) · 510 Bytes

keyExists

Status

keyExists is being deprecated in favor of keyExistsJson. It will be removed in future versions.

Signature

// Check if a key exists in a JSON string.
vm.keyExists(string memory json, string memory key) returns (bool)

Description

Checks if a key exists in a JSON string.

Examples

string memory path = "./path/to/jsonfile.json";
string memory json = vm.readFile(path);
bool exists = vm.keyExists(json, ".key");
assertTrue(exists);