When I retrieve an item object from the item array, the remix compiler doesn't show me one of the attributes of the item object, which is an array of a struct. This is the code, assume that the globalFarmers array has some data stored in it.

pragma solidity >=0.5.0 <0.6.0;
import "./farm.sol";
import "./manufacturer.sol";
contract Test is Farm, Manufacturer{

struct Item {

Farmer[] farmers;

string manufacturerName;
string manufacturerDate;

string distributorDate;
string distributorName;

Farmer [] public globalFarmers;
Item[] public items;

This is the only function that can add data for now.

function addManufacturerData(uint[] memory _farmerIds, string memory _name,
 string memory _date) public {

     Item storage tempItem = items[items.length-1];
     for(uint i = 0 ; i<_farmerIds.length; i++){

     tempItem.manufacturerName = _name;
     tempItem.manufacturerDate = _date;


The code compiles fine and here is the output when I fetch the item object from its array.

Remix response on retrieving the item from its array

Why the Farmer array is missing in the response?

1 Answer 1


Solidity does not know how to encode structs while returning them from a function by default.

Try adding:

pragma experimental ABIEncoderV2;

Take a look at this example:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.