Skip to content

Commit

Permalink
feat: add new serializeJson cheatcode to the Vm and to StdJson
Browse files Browse the repository at this point in the history
  • Loading branch information
vdrg committed Sep 9, 2023
1 parent 1d9650e commit fdeab8b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/StdJson.sol
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ library stdJson {
return vm.parseJsonBytesArray(json, key);
}

function serialize(string memory jsonKey, string memory rootObject) internal returns (string memory) {
return vm.serializeJson(jsonKey, rootObject);
}

function serialize(string memory jsonKey, string memory key, bool value) internal returns (string memory) {
return vm.serializeBool(jsonKey, key, value);
}
Expand Down
1 change: 1 addition & 0 deletions src/Vm.sol
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ interface VmSafe {

// Serialize a key and value to a JSON object stored in-memory that can be later written to a file
// It returns the stringified version of the specific JSON file up to that moment.
function serializeJson(string calldata objectKey, string calldata value) external returns (string memory json);
function serializeBool(string calldata objectKey, string calldata valueKey, bool value)
external
returns (string memory json);
Expand Down

0 comments on commit fdeab8b

Please sign in to comment.