如何使用resttemplate从json获取数组

时间:2014-12-04 07:12:25

标签: android json spring rest resttemplate

我的json看起来像

{

  "lent_items": [
    "item1",
    "item2"
  ],

  "lent_pessoas": [
    "person1",
    "person2"
  ],

  "id": "login"

}

我在做

Pessoa pessoa = restTemplate.getForObject(url, Pessoa.class);

Pessoa类有3个属性

@JsonIgnoreProperties(ignoreUnknown = true)
public class Pessoa {

private String id;
private ArrayList<String> lent_items;
private ArrayList<String> lent_pessoas;

我可以从json获取id,但不能获取数组

0 个答案:

没有答案