How can I return a dynamic string array? I came across serialization and deserialization. How can I serialize and deserialize dynamic string array ?
pragma solidity ^0.5.0;
contract Abc{
string[] st;
function add(string memory newValue) public {
st.push(newValue);
}
// return st
Best Answer
As of Solidity
0.7.5
theABIEncoderV2
is not experimental anymore and can be selected using the pragma directive.This gives native support for returning dynamic string arrays from functions.
On a side note, starting with Solidity
0.8.0
abicoder v2
is enabled by default and the pragma directive can therefore be omitted.