foundry-rs / foundry-rs/forge-std
docs(StdJson): document that key parameter must start with a dot
Open
documentation
good first issue
- Dominant language
- Solidity
- Stars
- 1.1k
- Forks
- 520
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 9
Description
The current documentation for the JSON cheats does not explain that the `key` parameter must be provided with a leading dot:
https://github.com/foundry-rs/forge-std/blob/e8a047e3f40f13fa37af6fe14e6e06283d9a060e/src/Vm.sol#L213-L239
I was trying to access the key by its simple name, like so:
```solidity
string memory json = '{"bar":"Hello World"}';
string memory bar = vm.parseJsonString(json, "bar");
```
And that didn't work until I added the leading dot, i.e. `.bar`.
Side note: the parameters for the `parseJsonSOMETHING` cheats have been left unnamed.
Contributor guide
Assessment
This issue has not been assessed yet.