diff --git a/CHANGELOG.md b/CHANGELOG.md index fd7b1417..4a53e182 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # CHANGELOG +## v2.0.2 + +### Date: 5-December-2024 + +-Github Issue fixed +-EntriesModel parsing fix + ## v2.0.1 ### Date: 21-October-2024 diff --git a/pom.xml b/pom.xml index be4c8527..ad852c7d 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.contentstack.sdk java - 2.0.1 + 2.0.2 jar contentstack-java Java SDK for Contentstack Content Delivery API @@ -20,11 +20,11 @@ 3.3.1 3.4.1 3.0.0 - 3.1.8 + 3.1.9 2.11.0 5.0.0-alpha.11 0.8.5 - 1.18.32 + 1.18.34 5.10.1 5.8.0-M1 2.8.8 @@ -187,7 +187,7 @@ com.fasterxml.jackson.core jackson-databind - 2.15.2 + 2.18.0 diff --git a/src/main/java/com/contentstack/sdk/EntriesModel.java b/src/main/java/com/contentstack/sdk/EntriesModel.java index 45cc9cfd..ff9a68c7 100644 --- a/src/main/java/com/contentstack/sdk/EntriesModel.java +++ b/src/main/java/com/contentstack/sdk/EntriesModel.java @@ -1,9 +1,9 @@ package com.contentstack.sdk; -import org.json.JSONArray; import org.json.JSONObject; import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; @@ -18,13 +18,14 @@ protected EntriesModel(JSONObject responseJSON) { this.jsonObject = responseJSON; objectList = new ArrayList<>(); Object entryList = jsonObject.opt("entries"); - if (entryList instanceof JSONArray) { - JSONArray entries = (JSONArray) entryList; - if (entries.length() > 0) { + if (entryList instanceof ArrayList) { + ArrayList entries = (ArrayList) entryList; + if (!entries.isEmpty()) { entries.forEach(model -> { - if (model instanceof JSONObject) { - JSONObject newModel = (JSONObject) model; - EntryModel entry = new EntryModel(newModel); + if (model instanceof LinkedHashMap) { + // Convert LinkedHashMap to JSONObject + JSONObject jsonModel = new JSONObject((LinkedHashMap) model); + EntryModel entry = new EntryModel(jsonModel); objectList.add(entry); } });