ethereum / remix-plugin

161 stars 101 forks source link

json input parameter in remix appear error #419

Open lyh169 opened 2 years ago

lyh169 commented 2 years ago
pragma solidity ^0.8.7;

contract Json {
    function getParameter(string memory jsonData) public view returns (string memory) {
        return jsonData;
    }
}

I want to store JSON input in my Smart Contract. Like

{ "name":"John" }

when i input { "name":"John" } or "{ \"name\":\"John\" }" ,Remix says, that there is an SyntaxError:

call to Json.getParameter errored: Error encoding arguments: Error: types/values length mismatch (count={"types":1,"values":3}, value={"types":["string"],"values":["{ \",":\"," }"]}, code=INVALID_ARGUMENT, version=abi/5.5.0)

image

Can someone help me?