In my project, I have a complex json answer. I want to read it using GSon.
JSON : {'FoodMenuRS':{'Results':[{'Items':{'Item':[{'@Id':'24'},{'@Id':'24'}]}}, {'Items':{'Item':{'@Id':'24'}}}]}}
It contains a JSONArray with the first "Item" and JSONObject with the second. Therefore, calling it leads to an error,
failed to deserialize json object {"@Id":"24"} given the type java.util.List<com.servlet.action.ItemInfo> and java.lang.IllegalStateException: This is not a JSON Array.
Please help how I should handle this scenario. Thanks.
source share