It returns a bit complex object in web3 and I want to store it in local storage. So I can reuse it again without connecting to the meta mask.
I tried to use JSON.strigify and all but it doesn't work here because it is very difficult to get the same state as before using JSON.parse(). What is the best way to store web3 instance?
This is how it looks if I log web3 Provider,
This is a JavaScript object, with functions, not a data object. You cannot serialise it in JSON.
You need to extract the relevant data from blockchain using getters and events and store that data in local storage. You cannot store connections, that are by definition online and active, in offline local storage.