with JSON from web service, Json Array as response
[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" }
After receiving a response in JsonArray Getting error reading Json Object 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); }
A serial analyzer was not found for the class org.json.JSONObject and no properties were found to create the BeanSerializer (to avoid an exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS)
java json spring rest serialization
abhishek ringsia
source share