Skip to content

Commit a3efb0c

Browse files
committed
Refactor whereIn and whereNotIn methods to use JSONObject directly for query values
1 parent a84b14c commit a3efb0c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/com/contentstack/sdk/Query.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,7 +1430,8 @@ public Query includeReferenceContentTypUid() {
14301430
public Query whereIn(@NotNull String key, Query queryObject) {
14311431
if(isValidKey(key)){
14321432
JSONObject inQueryObj = new JSONObject();
1433-
inQueryObj.put("$in_query", queryObject.queryValueJSON.toString());
1433+
JSONObject queryValue = new JSONObject(queryObject.queryValueJSON.toString());
1434+
inQueryObj.put("$in_query", queryValue);
14341435
queryValueJSON.put(key, inQueryObj);
14351436
} else {
14361437
throwException("whereIn", "Invalid key", null);
@@ -1459,7 +1460,8 @@ public Query whereIn(@NotNull String key, Query queryObject) {
14591460
public Query whereNotIn(@NotNull String key, Query queryObject) {
14601461
if(isValidKey(key)){
14611462
JSONObject inQueryObj = new JSONObject();
1462-
inQueryObj.put("$nin_query", queryObject.queryValueJSON.toString());
1463+
JSONObject queryValue = new JSONObject(queryObject.queryValueJSON.toString());
1464+
inQueryObj.put("$nin_query", queryValue);
14631465
queryValueJSON.put(key, inQueryObj);
14641466
} else {
14651467
throwException("whereNotIn", "Invalid key", null);

0 commit comments

Comments
 (0)