parseJsonKeys
Signature
Section titled “Signature”// Get list of keys present in a JSON stringfunction parseJsonKeys( string calldata json, string calldata key) external pure returns (string[] memory keys);Description
Section titled “Description”Gets list of keys present in a JSON string
Examples
Section titled “Examples”string memory json = '{"key": {"a": 1, "b": 2}}';string[] memory keys = vm.parseJsonKeys(json, ".key"); // ["a", "b"]string memory json = '{"key": "something"}';string[] memory keys = vm.parseJsonKeys(json, "$"); // ["key"]string memory json = '{"root_key": [{"a": 1, "b": 2}]}';string[] memory keys = vm.parseJsonKeys(json, ".root_key[0]"); // ["a", "b"]