From a3efb0c80046f526309c4c930041dfdbc0667711 Mon Sep 17 00:00:00 2001 From: reeshika-h Date: Tue, 21 Oct 2025 17:55:23 +0530 Subject: [PATCH] Refactor whereIn and whereNotIn methods to use JSONObject directly for query values --- src/main/java/com/contentstack/sdk/Query.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/contentstack/sdk/Query.java b/src/main/java/com/contentstack/sdk/Query.java index b8774af..6a40781 100644 --- a/src/main/java/com/contentstack/sdk/Query.java +++ b/src/main/java/com/contentstack/sdk/Query.java @@ -1430,7 +1430,8 @@ public Query includeReferenceContentTypUid() { public Query whereIn(@NotNull String key, Query queryObject) { if(isValidKey(key)){ JSONObject inQueryObj = new JSONObject(); - inQueryObj.put("$in_query", queryObject.queryValueJSON.toString()); + JSONObject queryValue = new JSONObject(queryObject.queryValueJSON.toString()); + inQueryObj.put("$in_query", queryValue); queryValueJSON.put(key, inQueryObj); } else { throwException("whereIn", "Invalid key", null); @@ -1459,7 +1460,8 @@ public Query whereIn(@NotNull String key, Query queryObject) { public Query whereNotIn(@NotNull String key, Query queryObject) { if(isValidKey(key)){ JSONObject inQueryObj = new JSONObject(); - inQueryObj.put("$nin_query", queryObject.queryValueJSON.toString()); + JSONObject queryValue = new JSONObject(queryObject.queryValueJSON.toString()); + inQueryObj.put("$nin_query", queryValue); queryValueJSON.put(key, inQueryObj); } else { throwException("whereNotIn", "Invalid key", null);