This is an automated email from the ASF dual-hosted git repository.

xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new cedb14a27 [type:fix] Solve the problem of converting jsonarray 
translate to map… (#3914)
cedb14a27 is described below

commit cedb14a2760c21300695abdac8d3c80a81e42e36
Author: wangteng <[email protected]>
AuthorDate: Mon Sep 5 15:01:13 2022 +0800

    [type:fix] Solve the problem of converting jsonarray translate to map… 
(#3914)
    
    * [type:fix] Solve the problem of converting jsonarray translate to map to 
process multiple lists
    
    * Update GsonUtils.java
    
      modify  new Gson().toJson(asJsonObject)  to  toJson(asJsonObject)
    
    Co-authored-by: tengwang8 <[email protected]>
---
 .../src/main/java/org/apache/shenyu/common/utils/GsonUtils.java   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/shenyu-common/src/main/java/org/apache/shenyu/common/utils/GsonUtils.java 
b/shenyu-common/src/main/java/org/apache/shenyu/common/utils/GsonUtils.java
index 4dd57b2de..cade2aa9a 100644
--- a/shenyu-common/src/main/java/org/apache/shenyu/common/utils/GsonUtils.java
+++ b/shenyu-common/src/main/java/org/apache/shenyu/common/utils/GsonUtils.java
@@ -326,7 +326,13 @@ public class GsonUtils {
                 list.add(null);
                 continue;
             }
-            String objStr = jsonElement.getAsString();
+            String objStr;
+            if (jsonElement instanceof JsonObject) {
+                JsonObject asJsonObject = jsonElement.getAsJsonObject();
+                objStr = toJson(asJsonObject);
+            } else {
+                objStr = jsonElement.getAsString();
+            }
             if (objStr.startsWith(LEFT_ANGLE_BRACKETS) && 
objStr.endsWith(RIGHT_ANGLE_BRACKETS)) {
                 list.add(convertToMap(jsonElement.toString()));
             } else {

Reply via email to