foundry-rs/forge-std

docs(StdJson): document that key parameter must start with a dot

Open

#394 建立於 2023年5月29日

在 GitHub 查看
 (0 留言) (0 反應) (0 負責人)Solidity (499 fork)user submission
documentationgood first issue

倉庫指標

Star
 (1,041 star)
PR 合併指標
 (平均合併 12分鐘) (30 天內合併 3 個 PR)

描述

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:

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.

貢獻者指南