See the example below
Warning from Remix: Experimental features are turned on. Do not use experimental features on live deployments.
pragma solidity ^0.5.12;
// Enable the ABI v2 Coder
pragma experimental ABIEncoderV2;
contract AbiTwoTest {
struct Item {
string str;
uint num;
bool bol;
}
struct Arg {
Item[] items;
}
mapping (address => Arg) itemsByUser;
// User struct in the event
event ItemAdded(string indexed str, uint num, bool bol);
// User struct in the method signature
function addItem(Item memory _item) public {
itemsByUser[msg.sender].items.push(_item);
emit ItemAdded(_item.str, _item.num, _item.bol);
}
// User struct in the returns
function item(address addr) public view returns (Arg memory items) {
return itemsByUser[addr];
}
}
Remix Testing
Add Item

Read Item

Contract ABI
[
{
"constant": false,
"inputs": [
{
"components": [
{
"internalType": "string",
"name": "str",
"type": "string"
},
{
"internalType": "uint256",
"name": "num",
"type": "uint256"
},
{
"internalType": "bool",
"name": "bol",
"type": "bool"
}
],
"internalType": "struct AbiTwoTest.Item",
"name": "_item",
"type": "tuple"
}
],
"name": "addItem",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "string",
"name": "str",
"type": "string"
},
{
"indexed": false,
"internalType": "uint256",
"name": "num",
"type": "uint256"
},
{
"indexed": false,
"internalType": "bool",
"name": "bol",
"type": "bool"
}
],
"name": "ItemAdded",
"type": "event"
},
{
"constant": true,
"inputs": [
{
"internalType": "address",
"name": "addr",
"type": "address"
}
],
"name": "item",
"outputs": [
{
"components": [
{
"components": [
{
"internalType": "string",
"name": "str",
"type": "string"
},
{
"internalType": "uint256",
"name": "num",
"type": "uint256"
},
{
"internalType": "bool",
"name": "bol",
"type": "bool"
}
],
"internalType": "struct AbiTwoTest.Item[]",
"name": "items",
"type": "tuple[]"
}
],
"internalType": "struct AbiTwoTest.Arg",
"name": "items",
"type": "tuple"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
]
str
,num
andbol
) is a valid type in Solidity. I sincerely doubt that this object can be encoded.