public class CacheStore implements Serializable {
private ArrayList<CacheItem> store;
}
The CacheItem has two attributes:
public class CacheItem implements Serializable {
private PacsBean entry;
private MessageKey key;
}
When marshalled, the generated json output is bellow:
[ {
"entry" : {"msgId" : "msg01","transactionId" : "001","instructionId" : "instr001"},
"key" : {"id" : "id1","bicCode" : "code1"}
},
{
"entry" : {"msgId" : "msg02","transactionId" : "002","instructionId" : "instr002"},
"key" : {"id" : "id1","bicCode" : "code1"}
}
]
When I try to unmarshall the json above, I'm expected to get a CacheStore with a store attribute containing the ArrayList of CacheItem.
The instruction that I'm using to unmarshall the json is the following:
ObjectMapper mapper = new ObjectMapper();
String jsonInput = BACKUP_LOCATION_FOLDER +"cachestore.json";
CacheStore cacheStore = mapper.readValue(new File(jsonInput), CacheStore.class);