11package com .contentstack .sdk ;
22
3- import org .json .JSONArray ;
43import org .json .JSONObject ;
54
65import java .util .ArrayList ;
6+ import java .util .LinkedHashMap ;
77import java .util .List ;
88import java .util .logging .Level ;
99import java .util .logging .Logger ;
@@ -18,13 +18,14 @@ protected EntriesModel(JSONObject responseJSON) {
1818 this .jsonObject = responseJSON ;
1919 objectList = new ArrayList <>();
2020 Object entryList = jsonObject .opt ("entries" );
21- if (entryList instanceof JSONArray ) {
22- JSONArray entries = (JSONArray ) entryList ;
23- if (entries .length () > 0 ) {
21+ if (entryList instanceof ArrayList ) {
22+ ArrayList < LinkedHashMap > entries = (ArrayList ) entryList ;
23+ if (! entries .isEmpty () ) {
2424 entries .forEach (model -> {
25- if (model instanceof JSONObject ) {
26- JSONObject newModel = (JSONObject ) model ;
27- EntryModel entry = new EntryModel (newModel );
25+ if (model instanceof LinkedHashMap ) {
26+ // Convert LinkedHashMap to JSONObject
27+ JSONObject jsonModel = new JSONObject ((LinkedHashMap <?, ?>) model );
28+ EntryModel entry = new EntryModel (jsonModel );
2829 objectList .add (entry );
2930 }
3031 });
0 commit comments