I know If the file User.json has
{
"name" : { "first" : "Joe", "last" : "Sixpack" },
"gender" : "MALE",
"verified" : false,
"userImage" : "Rm9vYmFyIQ=="
}
I can construct a single User object like this :
User user = mapper.readValue(new File("user.json"), User.class);
But how do I construct a list of objects if the file User.json has :
{
"name" : { "first" : "Joe", "last" : "Sixpack" },
"gender" : "MALE",
"verified" : false,
"userImage" : "Rm9vYmFyIQ=="
},
{
"name" : { "first" : "Jane", "last" : "Austen" },
"gender" : "FEMALE",
"verified" : false,
"userImage" : "DFREWEWE=="
}
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…