I'm trying to get back all the struct type records from my solidity contract function please see the below solidity contract code snippet
struct Record {
uint _id;
string _countryCode;
string _state;
string _postal;
string _location;
string _userId;
string _additionalDetails;
}
Record[] public records;
function getEntries() public view returns (Record[] memory) {
return records;
}
function setRecord(
string memory _countryCode,
string memory _state,
string memory _postal,
string memory _location,
string memory _userId,
string memory _additionalDetails
) public onlyOwner {
Record memory newStruct = Record({
_id: _counter + 1,
_countryCode: _countryCode,
_state: _state,
_postal: _postal,
_location: _location,
_userId: _userId,
_additionalDetails: _additionalDetails
});
records.push(newStruct);
_counter++;
}
I'm successfully able to add a new record using tronweb in nodejs below in my NodeJs code snippet
const walletAddress = "";
const privateKey = "";
const contractAddress = "";
tronweb.setAddress(walletAddress);
tronweb.setPrivateKey(privateKey);
const init = async () => {
let contract = await tronweb.contract().at(contractAddress);
const getRecords = async () => await contract.getEntries().call();
const setRecord = async () => await contract.setRecord(
"USA",
"LA",
"12345",
"Street 1",
"1324-12345-12456-45642",
"Testing notes"
).send({
"from": walletAddress
});
await setRecord();
getRecords().then(result => {
console.log(result); // getting empty array like [ [], [] ]
});
};
init();
Here is the console image of my nodejs script results which is always returning an empty array of arrays
Here is the Shasta Network transaction details with status CONFIRMED
Is there anyone who can help me?


In ABI, any return value of a struct type will be interpreted as
tuple. In your case, its type istuple[].The library has no clue what's your
tupleis, how long it is, what's the type.You should parse the return data by hand.
To parse the constant_result: