back soft

مطالب مرتبط با «jackson json serialize list» در back soft | نویسنده: استخدام کار

Jackson JSON Deserialization List

Vote count: 0 I want to deserialize a JSON string using the same POJO for two king of messages. Take a look at the message below { "success": true, "data": [ { "id": 2, "comments": null }, { "id": 3, "comments": null } ] } The data is an array, but sometimes the data is a single object: { "success": true, "data": { "id": 2, "comments": null } } My POJO looks like this: public void setData(List data) { this.data = data; } Is there any way to deserialize the second message (where data is not an array) using the same class? Kind regards, Ricardo asked 1 min agouser1972700 Let's block ads! بخوانید...

ادامه مطلب

برچسب‌های مرتبط

jackson json deserialize list | jackson json serialize list of objects | jackson json serialize list | jackson json list serializer example | jackson json deserialize generic list