diff --git a/samples/52.teams-messaging-extensions-search-auth-config/pom.xml b/samples/52.teams-messaging-extensions-search-auth-config/pom.xml
index f71b7b8e0..27f270028 100644
--- a/samples/52.teams-messaging-extensions-search-auth-config/pom.xml
+++ b/samples/52.teams-messaging-extensions-search-auth-config/pom.xml
@@ -89,12 +89,6 @@
4.6.1-preview8
compile
-
- org.json
- json
- 20201115
- compile
-
diff --git a/samples/52.teams-messaging-extensions-search-auth-config/src/main/java/com/microsoft/bot/sample/teamssearchauth/TeamsMessagingExtensionsSearchAuthConfigBot.java b/samples/52.teams-messaging-extensions-search-auth-config/src/main/java/com/microsoft/bot/sample/teamssearchauth/TeamsMessagingExtensionsSearchAuthConfigBot.java
index 5c83ecd2f..888e23c63 100644
--- a/samples/52.teams-messaging-extensions-search-auth-config/src/main/java/com/microsoft/bot/sample/teamssearchauth/TeamsMessagingExtensionsSearchAuthConfigBot.java
+++ b/samples/52.teams-messaging-extensions-search-auth-config/src/main/java/com/microsoft/bot/sample/teamssearchauth/TeamsMessagingExtensionsSearchAuthConfigBot.java
@@ -3,6 +3,9 @@
package com.microsoft.bot.sample.teamssearchauth;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
import com.microsoft.bot.builder.StatePropertyAccessor;
import com.microsoft.bot.builder.TurnContext;
import com.microsoft.bot.builder.UserState;
@@ -18,8 +21,6 @@
import okhttp3.Response;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
-import org.json.JSONArray;
-import org.json.JSONObject;
import org.slf4j.LoggerFactory;
import java.io.IOException;
@@ -133,11 +134,14 @@ private CompletableFuture packageExtensionQuery(
return findPackages(search).thenApply(packages -> {
List attachments = new ArrayList<>();
for (String[] item : packages) {
+ ObjectNode data = Serialization.createObjectNode();
+ data.set("data", Serialization.objectToTree(item));
+
ThumbnailCard previewCard = new ThumbnailCard() {{
setTitle(item[0]);
setTap(new CardAction() {{
setType(ActionTypes.INVOKE);
- setValue(new JSONObject().put("data", item).toString());
+ setValue(data);
}});
}};
@@ -348,21 +352,21 @@ private CompletableFuture> findPackages(String text) {
List filteredItems = new ArrayList();
try {
Response response = client.newCall(request).execute();
- JSONObject obj = new JSONObject(response.body().string());
- JSONArray dataArray = (JSONArray) obj.get("data");
+ JsonNode obj = Serialization.jsonToTree(response.body().string());
+ ArrayNode dataArray = (ArrayNode) obj.get("data");
- dataArray.forEach(i -> {
- JSONObject item = (JSONObject) i;
+ for (int i = 0; i < dataArray.size(); i++) {
+ JsonNode item = dataArray.get(i);
filteredItems.add(
- new String[]{
- item.getString("id"), item.getString("version"),
- item.getString("description"),
- item.has("projectUrl") ? item.getString("projectUrl") : "",
- item.has("iconUrl") ? item.getString("iconUrl") : ""
+ new String[] {
+ item.get("id").asText(),
+ item.get("version").asText(),
+ item.get("description").asText(),
+ item.has("projectUrl") ? item.get("projectUrl").asText() : "",
+ item.has("iconUrl") ? item.get("iconUrl").asText() : ""
}
);
- });
-
+ }
} catch (IOException e) {
LoggerFactory.getLogger(TeamsMessagingExtensionsSearchAuthConfigBot.class)
.error("findPackages", e);