Error: you must provide the JSON interface of the contract when instantiating a contract object 1


This error occurs while testing contracts.

Solution: you need to parse the ABI into JSON.

Code:

 

parse the ABI : const abi = JSON.parse(contractJson);

instantiate the contract : var contract = new web3.eth.Contract(abi);