Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 409 Bytes

key-exists-json.md

File metadata and controls

21 lines (15 loc) · 409 Bytes

keyExistsJson

Signature

// Check if a key exists in a JSON string.
vm.keyExistsJson(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.keyExistsJson(json, ".key");
assertTrue(exists);