Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

escaped characters in json are not parsed correctly #332

Open
Tracked by #3801
karmacoma-eth opened this issue Mar 24, 2023 · 1 comment
Open
Tracked by #3801

escaped characters in json are not parsed correctly #332

karmacoma-eth opened this issue Mar 24, 2023 · 1 comment

Comments

@karmacoma-eth
Copy link
Contributor

Repro:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import {stdJson} from "forge-std/StdJson.sol";

import "forge-std/Test.sol";

contract JsonTest is Test {
    function testEscapedQuotes() public {
        string memory json = '{"foo":"quotation mark: \'\\"\' and backslash: \\\\"}';

        assertEq(stdJson.readString(json, ".foo"), 'quotation mark: \'"\' and backslash: \\');
    }
}

The test passes with b4f1215 but fails with f8e700e

[FAIL. Reason: Assertion failed.] testEscapedQuotes() (gas: 19525)
Logs:
  Error: a == b not satisfied [string]
    Expected: quotation mark: '"' and backslash: \
      Actual: quotation mark: '\' and backslash: \\
@mds1
Copy link
Collaborator

mds1 commented Mar 24, 2023

Tracking in foundry-rs/foundry#3801, cc @odyslam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants