Skip to content

JSON Parsing Docs are Outdated #372

Open
@daweth

Description

The docs located here: https://book.getfoundry.sh/cheatcodes/parse-json

are completely outdated. The example code

string memory root = vm.projectRoot();
string memory path = string.concat(root, "/src/test/fixtures/broadcast.log.json");
string memory json = vm.readFile(path);
bytes memory transactionDetails = json.parseRaw(".transactions[0].tx");
RawTx1559Detail memory rawTxDetail = abi.decode(transactionDetails, (RawTx1559Detail));

results in an error

error[9574]: TypeError: Type bytes memory is not implicitly convertible to expected type string memory.
error[8015]: TypeError: Invalid type for argument in the bytes.concat function call. bytes or fixed bytes type is required, but string provided.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions