avere JSON dal servizio web, JSON Array come rispostaNo serializzatore trovato per la classe org.json.JSONObject e immobili scoperto per creare BeanSerializer
[3]
0: {
id: 2
name: "a561137"
password: "test"
firstName: "abhishek"
lastName: "ringsia"
organization: "bbb"
}-
1: {
id: 3
name: "a561023"
password: "hello"
firstName: "hello"
lastName: "hello"
organization: "hello"
}-
2: {
id: 4
name: "a541234"
password: "hello"
firstName: "hello"
lastName: "hello"
organization: "hello"
}
dopo avere ottenuto risposta in JsonArray errore durante la lettura Ottenere JSON oggetto di jSON Array:
List<User> list = new ArrayList<User>();
JSONArray jsonArr = new JSONArray(response);
for (int i = 0; i < jsonArr.length(); i++) {
JSONObject jsonObj = jsonArr.getJSONObject(i);
ObjectMapper mapper = new ObjectMapper();
User usr= mapper.convertValue(jsonObj, User.class);
list.add(usr);
}
No serializzatore trovato per la classe org.json.JSONObject e immobili scoperto per creare BeanSerializer (per evitare eccezioni, disabilitare SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS))