Repository: alibaba/fastjson2
Pull request #3529 (2025-04-30 14:22:23)

fix support list for JSONPathSingleName, for issue #3331
### What this PR does / why we need it?

fix support list for JSONPathSingleName

### Summary of your change



#### Please indicate you've done the following:

- [ ] Made sure tests are passing and test coverage is added if needed.
- [ ] Made sure commit message follow the rule of [Conventional Commits specification](https://www.conventionalcommits.org/).
- [ ] Considered the docs impact and opened a new docs issue or PR with docs changes if needed.



Patch:
diff --git a/core/src/main/java/com/alibaba/fastjson2/JSONPathSegmentName.java b/core/src/main/java/com/alibaba/fastjson2/JSONPathSegmentName.java
index a0ad4eb78..37dfe666c 100644
--- a/core/src/main/java/com/alibaba/fastjson2/JSONPathSegmentName.java
+++ b/core/src/main/java/com/alibaba/fastjson2/JSONPathSegmentName.java
@@ -333,6 +333,10 @@ class JSONPathSegmentName
                 ? context.root
                 : context.parent.value;
 
+        if (object instanceof JSONPath.Sequence) {
+            object = ((JSONPath.Sequence) object).values;
+        }
+
         if (object instanceof Map) {
             Map map = (Map) object;
             Object origin = map.put(name, value);
diff --git a/core/src/main/java/com/alibaba/fastjson2/JSONPathSingleName.java b/core/src/main/java/com/alibaba/fastjson2/JSONPathSingleName.java
index c160bbc67..f871d93ed 100644
--- a/core/src/main/java/com/alibaba/fastjson2/JSONPathSingleName.java
+++ b/core/src/main/java/com/alibaba/fastjson2/JSONPathSingleName.java
@@ -115,6 +115,11 @@ final class JSONPathSingleName
             return ((Map) root).containsKey(name);
         }
 
+        if (root instanceof List) {
+            List list = (List) root;
+            return !list.isEmpty() && contains(list.get(0));
+        }
+
         ObjectWriterProvider provider = getWriterContext().provider;
 
         ObjectWriter objectWriter = provider.getObjectWriter(root.getClass());
diff --git a/core/src/main/java/com/alibaba/fastjson2/JSONWriter.java b/core/src/main/java/com/alibaba/fastjson2/JSONWriter.java
index 92d0ea94d..36af401c3 100644
--- a/core/src/main/java/com/alibaba/fastjson2/JSONWriter.java
+++ b/core/src/main/java/com/alibaba/fastjson2/JSONWriter.java
@@ -1171,8 +1171,12 @@ public abstract class JSONWriter
     }
 
     public void writeArrayNull() {
+        writeArrayNull(this.context.features);
+    }
+
+    public void writeArrayNull(long features) {
         String raw;
-        if ((this.context.features & (MASK_NULL_AS_DEFAULT_VALUE | MASK_WRITE_NULL_LIST_AS_EMPTY)) != 0) {
+        if ((features & (MASK_NULL_AS_DEFAULT_VALUE | MASK_WRITE_NULL_LIST_AS_EMPTY)) != 0) {
             raw = "[]";
         } else {
             raw = "null";
diff --git a/core/src/main/java/com/alibaba/fastjson2/reader/ObjectReaderAdapter.java b/core/src/main/java/com/alibaba/fastjson2/reader/ObjectReaderAdapter.java
index 046b59ca9..0caa3b5c0 100644
--- a/core/src/main/java/com/alibaba/fastjson2/reader/ObjectReaderAdapter.java
+++ b/core/src/main/java/com/alibaba/fastjson2/reader/ObjectReaderAdapter.java
@@ -7,6 +7,7 @@ import com.alibaba.fastjson2.util.Fnv;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Modifier;
 import java.lang.reflect.Type;
 import java.util.*;
 import java.util.function.Consumer;
@@ -697,6 +698,17 @@ public class ObjectReaderAdapter<T>
                     continue;
                 }
 
+                if (fieldReader.field != null && Modifier.isFinal(fieldReader.field.getModifiers())) {
+                    try {
+                        Object value = fieldReader.method.invoke(object);
+                        if (value instanceof Collection && !((Collection) value).isEmpty()) {
+                            continue;
+                        }
+                    } catch (Exception e) {
+                        // just ignore
+                    }
+                }
+
                 try {
                     if (fieldValue.getClass() == fieldReader.fieldType) {
                         fieldReader.accept(object, fieldValue);
diff --git a/core/src/main/java/com/alibaba/fastjson2/reader/ObjectReaderNoneDefaultConstructor.java b/core/src/main/java/com/alibaba/fastjson2/reader/ObjectReaderNoneDefaultConstructor.java
index 19ff68369..eecdb649f 100644
--- a/core/src/main/java/com/alibaba/fastjson2/reader/ObjectReaderNoneDefaultConstructor.java
+++ b/core/src/main/java/com/alibaba/fastjson2/reader/ObjectReaderNoneDefaultConstructor.java
@@ -6,6 +6,7 @@ import com.alibaba.fastjson2.util.TypeUtils;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Modifier;
 import java.lang.reflect.Type;
 import java.util.*;
 import java.util.function.BiFunction;
@@ -563,6 +564,17 @@ public class ObjectReaderNoneDefaultConstructor<T>
                     continue;
                 }
 
+                if (fieldReader.field != null && Modifier.isFinal(fieldReader.field.getModifiers())) {
+                    try {
+                        Object value = fieldReader.method.invoke(object);
+                        if (value instanceof Collection && !((Collection) value).isEmpty()) {
+                            continue;
+                        }
+                    } catch (Exception e) {
+                        // just ignore
+                    }
+                }
+
                 Class<?> valueClass = fieldValue.getClass();
                 Class fieldClass = fieldReader.fieldClass;
                 Type fieldType = fieldReader.fieldType;
diff --git a/core/src/main/java/com/alibaba/fastjson2/schema/AllOf.java b/core/src/main/java/com/alibaba/fastjson2/schema/AllOf.java
index 8ec4bc455..d8121b165 100644
--- a/core/src/main/java/com/alibaba/fastjson2/schema/AllOf.java
+++ b/core/src/main/java/com/alibaba/fastjson2/schema/AllOf.java
@@ -30,7 +30,7 @@ final class AllOf
                 itemSchema = (Boolean) item ? Any.INSTANCE : Any.NOT_ANY;
             } else {
                 JSONObject itemObject = (JSONObject) item;
-                if (!itemObject.containsKey("type") && type != null) {
+                if (!itemObject.containsKey("$ref") && !itemObject.containsKey("type") && type != null) {
                     switch (type) {
                         case String:
                             itemSchema = new StringSchema(itemObject);
diff --git a/core/src/main/java/com/alibaba/fastjson2/schema/NumberSchema.java b/core/src/main/java/com/alibaba/fastjson2/schema/NumberSchema.java
index 721cb13c4..213fe50ac 100644
--- a/core/src/main/java/com/alibaba/fastjson2/schema/NumberSchema.java
+++ b/core/src/main/java/com/alibaba/fastjson2/schema/NumberSchema.java
@@ -280,7 +280,7 @@ public final class NumberSchema
         }
 
         if (maximumLongValue != Long.MIN_VALUE) {
-            object.put(exclusiveMaximum ? "exclusiveMaximum" : "maximum", minimumLongValue);
+            object.put(exclusiveMaximum ? "exclusiveMaximum" : "maximum", maximumLongValue);
         } else if (maximum != null) {
             object.put(exclusiveMaximum ? "exclusiveMaximum" : "maximum", maximum);
         }
diff --git a/core/src/main/java/com/alibaba/fastjson2/writer/FieldWriterListStrFunc.java b/core/src/main/java/com/alibaba/fastjson2/writer/FieldWriterListStrFunc.java
index acabbdc3e..b65962691 100644
--- a/core/src/main/java/com/alibaba/fastjson2/writer/FieldWriterListStrFunc.java
+++ b/core/src/main/java/com/alibaba/fastjson2/writer/FieldWriterListStrFunc.java
@@ -51,7 +51,7 @@ final class FieldWriterListStrFunc<T>
         if (list == null) {
             if ((features & (WriteNulls.mask | NullAsDefaultValue.mask | WriteNullListAsEmpty.mask)) != 0) {
                 writeFieldName(jsonWriter);
-                jsonWriter.writeArrayNull();
+                jsonWriter.writeArrayNull(features);
                 return true;
             } else {
                 return false;
diff --git a/core/src/main/java/com/alibaba/fastjson2/writer/ObjectWriterCreatorASM.java b/core/src/main/java/com/alibaba/fastjson2/writer/ObjectWriterCreatorASM.java
index a69e2511f..5c0dd1074 100644
--- a/core/src/main/java/com/alibaba/fastjson2/writer/ObjectWriterCreatorASM.java
+++ b/core/src/main/java/com/alibaba/fastjson2/writer/ObjectWriterCreatorASM.java
@@ -2452,7 +2452,6 @@ public class ObjectWriterCreatorASM
             int i
     ) {
         Class<?> fieldClass = fieldWriter.fieldClass;
-        boolean writeAsString = (fieldWriter.features & WriteNonStringValueAsString.mask) != 0;
 
         if (fieldClass == boolean.class) {
             gwFieldValueBooleanV(mwc, fieldWriter, OBJECT, i, false);
@@ -3024,14 +3023,17 @@ public class ObjectWriterCreatorASM
         mw.goto_(notNull_);
 
         mw.visitLabel(null_);
-        mwc.genIsEnabled(WriteNulls.mask | NullAsDefaultValue.mask | WriteNullListAsEmpty.mask, notNull_);
+        mwc.genIsEnabled(fieldWriter.features, WriteNulls.mask | NullAsDefaultValue.mask | WriteNullListAsEmpty.mask, notNull_);
 
         // writeFieldName(w);
         gwFieldName(mwc, fieldWriter, i);
 
         // jw.writeNull
         mw.aload(JSON_WRITER);
-        mw.invokevirtual(TYPE_JSON_WRITER, "writeArrayNull", "()V");
+        mw.lload(mwc.var2(CONTEXT_FEATURES));
+        mw.visitLdcInsn(fieldWriter.features);
+        mw.lor();
+        mw.invokevirtual(TYPE_JSON_WRITER, "writeArrayNull", "(J)V");
 
         mw.visitLabel(notNull_);
     }
@@ -5018,6 +5020,19 @@ public class ObjectWriterCreatorASM
             }
         }
 
+        void genIsEnabled(long fieldFeatures, long features, Label elseLabel) {
+            mw.lload(var2(CONTEXT_FEATURES));
+            mw.visitLdcInsn(fieldFeatures);
+            mw.lor();
+            mw.visitLdcInsn(features);
+            mw.land();
+            mw.lconst_0();
+            mw.lcmp();
+            if (elseLabel != null) {
+                mw.ifeq(elseLabel);
+            }
+        }
+
         void genIsDisabled(long features, Label elseLabel) {
             mw.lload(var2(CONTEXT_FEATURES));
             mw.visitLdcInsn(features);
diff --git a/fastjson1-compatible/src/main/java/com/alibaba/fastjson/JSON.java b/fastjson1-compatible/src/main/java/com/alibaba/fastjson/JSON.java
index a02a507e8..3b728413c 100644
--- a/fastjson1-compatible/src/main/java/com/alibaba/fastjson/JSON.java
+++ b/fastjson1-compatible/src/main/java/com/alibaba/fastjson/JSON.java
@@ -37,7 +37,8 @@ import java.util.function.Supplier;
 
 public abstract class JSON
         implements JSONAware {
-    private static TimeZone DEFAULT_TIME_ZONE = TimeZone.getDefault();
+    private static final TimeZone DEFAULT_TIME_ZONE = TimeZone.getDefault();
+    private static final int MAX_LEVEL = 2048;
     public static final String VERSION = com.alibaba.fastjson2.JSON.VERSION;
     static final Cache CACHE = new Cache();
     static final AtomicReferenceFieldUpdater<Cache, char[]> CHARS_UPDATER
@@ -45,7 +46,9 @@ public abstract class JSON
     public static TimeZone defaultTimeZone = DEFAULT_TIME_ZONE;
     public static Locale defaultLocale = Locale.getDefault();
     public static String DEFAULT_TYPE_KEY = "@type";
+    @Deprecated
     public static String DEFFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
+    public static String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
     public static int DEFAULT_PARSER_FEATURE;
     public static int DEFAULT_GENERATE_FEATURE;
 
@@ -158,7 +161,7 @@ public abstract class JSON
             context.config(JSONReader.Feature.SupportAutoType);
         }
 
-        String defaultDateFormat = JSON.DEFFAULT_DATE_FORMAT;
+        String defaultDateFormat = JSON.DEFAULT_DATE_FORMAT;
         if (!"yyyy-MM-dd HH:mm:ss".equals(defaultDateFormat)) {
             context.setDateFormat(defaultDateFormat);
         }
@@ -213,7 +216,7 @@ public abstract class JSON
         );
         JSONReader reader = JSONReader.of(text, context);
 
-        String defaultDateFormat = JSON.DEFFAULT_DATE_FORMAT;
+        String defaultDateFormat = JSON.DEFAULT_DATE_FORMAT;
         if (!"yyyy-MM-dd HH:mm:ss".equals(defaultDateFormat)) {
             context.setDateFormat(defaultDateFormat);
         }
@@ -1304,7 +1307,7 @@ public abstract class JSON
         }
 
         if ((featuresValue & SerializerFeature.WriteDateUseDateFormat.mask) != 0) {
-            context.setDateFormat(JSON.DEFFAULT_DATE_FORMAT);
+            context.setDateFormat(JSON.DEFAULT_DATE_FORMAT);
         }
 
         if ((featuresValue & SerializerFeature.BeanToArray.mask) != 0) {
@@ -2304,22 +2307,37 @@ public abstract class JSON
             return javaObject;
         }
 
-        Object json;
         try {
-            json = com.alibaba.fastjson2.JSON.toJSON(javaObject);
+            return adaptResult(com.alibaba.fastjson2.JSON.toJSON(javaObject));
         } catch (com.alibaba.fastjson2.JSONException e) {
             throw new JSONException(e.getMessage(), e);
         }
+    }
 
-        if (json instanceof com.alibaba.fastjson2.JSONObject) {
-            return new JSONObject((com.alibaba.fastjson2.JSONObject) json);
-        }
+    public static Object adaptResult(Object result) {
+        return adaptResult(result, 0);
+    }
 
-        if (json instanceof com.alibaba.fastjson2.JSONArray) {
-            return new JSONArray((com.alibaba.fastjson2.JSONArray) json);
+    private static Object adaptResult(Object result, int level) {
+        if (level > MAX_LEVEL) {
+            throw new JSONException("level too large : " + level);
         }
-
-        return json;
+        if (result instanceof com.alibaba.fastjson2.JSONObject) {
+            JSONObject jsonObject = new JSONObject();
+            com.alibaba.fastjson2.JSONObject object = (com.alibaba.fastjson2.JSONObject) result;
+            for (Map.Entry<String, Object> entry : object.entrySet()) {
+                jsonObject.put(entry.getKey(), adaptResult(entry.getValue(), level + 1));
+            }
+            return jsonObject;
+        } else if (result instanceof com.alibaba.fastjson2.JSONArray) {
+            JSONArray jsonArray = new JSONArray();
+            com.alibaba.fastjson2.JSONArray array = (com.alibaba.fastjson2.JSONArray) result;
+            for (int i = 0; i < array.size(); ++i) {
+                jsonArray.set(i, adaptResult(array.get(i), level + 1));
+            }
+            return jsonArray;
+        }
+        return result;
     }
 
     public static Object toJSON(Object javaObject, SerializeConfig config) {
diff --git a/fastjson1-compatible/src/main/java/com/alibaba/fastjson/JSONArray.java b/fastjson1-compatible/src/main/java/com/alibaba/fastjson/JSONArray.java
index a9eed4ead..a2981e868 100644
--- a/fastjson1-compatible/src/main/java/com/alibaba/fastjson/JSONArray.java
+++ b/fastjson1-compatible/src/main/java/com/alibaba/fastjson/JSONArray.java
@@ -592,17 +592,7 @@ public class JSONArray
 
     @Override
     public Object get(int index) {
-        Object value = list.get(index);
-
-        if (value instanceof com.alibaba.fastjson2.JSONObject) {
-            return new JSONObject((com.alibaba.fastjson2.JSONObject) value);
-        }
-
-        if (value instanceof com.alibaba.fastjson2.JSONArray) {
-            return new JSONArray((com.alibaba.fastjson2.JSONArray) value);
-        }
-
-        return value;
+        return adaptResult(list.get(index));
     }
 
     /**
@@ -845,7 +835,7 @@ public class JSONArray
         ObjectReader objectReader = provider.getObjectReader(clazz);
         JSONReader jsonReader = JSONReader.of(json);
 
-        String defaultDateFormat = JSON.DEFFAULT_DATE_FORMAT;
+        String defaultDateFormat = JSON.DEFAULT_DATE_FORMAT;
         if (!"yyyy-MM-dd HH:mm:ss".equals(defaultDateFormat)) {
             jsonReader
                     .getContext()
diff --git a/fastjson1-compatible/src/main/java/com/alibaba/fastjson/JSONObject.java b/fastjson1-compatible/src/main/java/com/alibaba/fastjson/JSONObject.java
index bd0b7ceb9..a6260eea4 100755
--- a/fastjson1-compatible/src/main/java/com/alibaba/fastjson/JSONObject.java
+++ b/fastjson1-compatible/src/main/java/com/alibaba/fastjson/JSONObject.java
@@ -127,15 +127,7 @@ public class JSONObject
             val = map.get(key.toString());
         }
 
-        if (val instanceof com.alibaba.fastjson2.JSONObject) {
-            val = new com.alibaba.fastjson.JSONObject((com.alibaba.fastjson2.JSONObject) val);
-        }
-
-        if (val instanceof com.alibaba.fastjson2.JSONArray) {
-            val = new com.alibaba.fastjson.JSONArray((com.alibaba.fastjson2.JSONArray) val);
-        }
-
-        return val;
+        return adaptResult(val);
     }
 
     public JSONObject getJSONObject(String key) {
@@ -249,7 +241,7 @@ public class JSONObject
         boolean fieldBased = jsonReader.getContext().isEnabled(JSONReader.Feature.FieldBased);
         ObjectReader objectReader = provider.getObjectReader(clazz, fieldBased);
 
-        String defaultDateFormat = JSON.DEFFAULT_DATE_FORMAT;
+        String defaultDateFormat = JSON.DEFAULT_DATE_FORMAT;
         if (!"yyyy-MM-dd HH:mm:ss".equals(defaultDateFormat)) {
             jsonReader
                     .getContext()
@@ -290,7 +282,7 @@ public class JSONObject
         ObjectReader objectReader = provider.getObjectReader(type);
         JSONReader jsonReader = JSONReader.of(json);
 
-        String defaultDateFormat = JSON.DEFFAULT_DATE_FORMAT;
+        String defaultDateFormat = JSON.DEFAULT_DATE_FORMAT;
         if (!"yyyy-MM-dd HH:mm:ss".equals(defaultDateFormat)) {
             jsonReader
                     .getContext()
@@ -408,7 +400,7 @@ public class JSONObject
         boolean fieldBased = jsonReader.getContext().isEnabled(JSONReader.Feature.FieldBased);
         ObjectReader objectReader = provider.getObjectReader(type, fieldBased);
 
-        String defaultDateFormat = JSON.DEFFAULT_DATE_FORMAT;
+        String defaultDateFormat = JSON.DEFAULT_DATE_FORMAT;
         if (!"yyyy-MM-dd HH:mm:ss".equals(defaultDateFormat)) {
             jsonReader
                     .getContext()
diff --git a/fastjson1-compatible/src/main/java/com/alibaba/fastjson/JSONPath.java b/fastjson1-compatible/src/main/java/com/alibaba/fastjson/JSONPath.java
index 2908bb4bf..defecdd9e 100644
--- a/fastjson1-compatible/src/main/java/com/alibaba/fastjson/JSONPath.java
+++ b/fastjson1-compatible/src/main/java/com/alibaba/fastjson/JSONPath.java
@@ -50,23 +50,11 @@ public class JSONPath {
     }
 
     public static Object eval(String rootObject, String path) {
-        Object result = com.alibaba.fastjson2.JSONPath.eval(rootObject, path);
-        return adaptResult(result);
+        return JSON.adaptResult(com.alibaba.fastjson2.JSONPath.eval(rootObject, path));
     }
 
     public static Object eval(Object rootObject, String path) {
-        com.alibaba.fastjson2.JSONPath jsonPath = com.alibaba.fastjson2.JSONPath.of(path);
-        Object result = jsonPath.eval(rootObject);
-        return adaptResult(result);
-    }
-
-    private static Object adaptResult(Object result) {
-        if (result instanceof com.alibaba.fastjson2.JSONArray) {
-            result = new JSONArray((com.alibaba.fastjson2.JSONArray) result);
-        } else if (result instanceof com.alibaba.fastjson2.JSONObject) {
-            result = new JSONObject((com.alibaba.fastjson2.JSONObject) result);
-        }
-        return result;
+        return JSON.adaptResult(com.alibaba.fastjson2.JSONPath.of(path).eval(rootObject));
     }
 
     public static boolean set(Object rootObject, String path, Object value) {
@@ -90,7 +78,7 @@ public class JSONPath {
         JSONReader.Context context = JSON.createReadContext(JSON.DEFAULT_PARSER_FEATURE);
         JSONReader jsonReader = JSONReader.of(json, context);
         Object result = jsonPath.extract(jsonReader);
-        return adaptResult(result);
+        return JSON.adaptResult(result);
     }
 
     public static boolean remove(Object root, String path) {
diff --git a/fastjson1-compatible/src/main/java/com/alibaba/fastjson/JSONWriter.java b/fastjson1-compatible/src/main/java/com/alibaba/fastjson/JSONWriter.java
index fb5d0728d..bd8aa96f3 100644
--- a/fastjson1-compatible/src/main/java/com/alibaba/fastjson/JSONWriter.java
+++ b/fastjson1-compatible/src/main/java/com/alibaba/fastjson/JSONWriter.java
@@ -57,7 +57,7 @@ public class JSONWriter {
                 break;
             case WriteDateUseDateFormat:
                 if (state) {
-                    ctx.setDateFormat(JSON.DEFFAULT_DATE_FORMAT);
+                    ctx.setDateFormat(JSON.DEFAULT_DATE_FORMAT);
                 }
                 break;
             case BeanToArray:
diff --git a/fastjson1-compatible/src/main/java/com/alibaba/fastjson/parser/ParserConfig.java b/fastjson1-compatible/src/main/java/com/alibaba/fastjson/parser/ParserConfig.java
index 6781ea520..452573a68 100644
--- a/fastjson1-compatible/src/main/java/com/alibaba/fastjson/parser/ParserConfig.java
+++ b/fastjson1-compatible/src/main/java/com/alibaba/fastjson/parser/ParserConfig.java
@@ -196,7 +196,7 @@ public class ParserConfig {
     /**
      * fieldName,field ，先生成fieldName的快照，减少之后的findField的轮询
      *
-     * @param clazz
+     * @param clazz the specified goal class
      * @param fieldCacheMap :map&lt;fieldName ,Field&gt;
      */
     public static void parserAllFieldToCache(Class<?> clazz, Map<String, Field> fieldCacheMap) {
diff --git a/fastjson1-compatible/src/main/java/com/alibaba/fastjson/serializer/JSONSerializer.java b/fastjson1-compatible/src/main/java/com/alibaba/fastjson/serializer/JSONSerializer.java
index 6afd15f4a..c299a842a 100644
--- a/fastjson1-compatible/src/main/java/com/alibaba/fastjson/serializer/JSONSerializer.java
+++ b/fastjson1-compatible/src/main/java/com/alibaba/fastjson/serializer/JSONSerializer.java
@@ -96,7 +96,7 @@ public class JSONSerializer {
                 ctx.config(JSONWriter.Feature.IgnoreErrorGetter);
                 break;
             case WriteDateUseDateFormat:
-                ctx.setDateFormat(JSON.DEFFAULT_DATE_FORMAT);
+                ctx.setDateFormat(JSON.DEFAULT_DATE_FORMAT);
                 break;
             case BeanToArray:
                 ctx.config(JSONWriter.Feature.BeanToArray);
diff --git a/fastjson1-compatible/src/main/java/com/alibaba/fastjson/support/config/FastJsonConfig.java b/fastjson1-compatible/src/main/java/com/alibaba/fastjson/support/config/FastJsonConfig.java
index 8e3efc9bb..667a64b3a 100644
--- a/fastjson1-compatible/src/main/java/com/alibaba/fastjson/support/config/FastJsonConfig.java
+++ b/fastjson1-compatible/src/main/java/com/alibaba/fastjson/support/config/FastJsonConfig.java
@@ -186,7 +186,7 @@ public class FastJsonConfig {
      * @return the dateFormat
      */
     public String getDateFormat() {
-        dateFormat = JSON.DEFFAULT_DATE_FORMAT;
+        dateFormat = JSON.DEFAULT_DATE_FORMAT;
         return dateFormat;
     }
 
@@ -194,7 +194,7 @@ public class FastJsonConfig {
      * @param dateFormat the dateFormat to set
      */
     public void setDateFormat(String dateFormat) {
-        JSON.DEFFAULT_DATE_FORMAT = dateFormat;
+        JSON.DEFAULT_DATE_FORMAT = dateFormat;
         this.dateFormat = dateFormat;
     }
 
diff --git a/fastjson1-compatible/src/main/java/com/alibaba/fastjson/support/spring/FastJsonJsonView.java b/fastjson1-compatible/src/main/java/com/alibaba/fastjson/support/spring/FastJsonJsonView.java
index 089afca69..c7c852313 100644
--- a/fastjson1-compatible/src/main/java/com/alibaba/fastjson/support/spring/FastJsonJsonView.java
+++ b/fastjson1-compatible/src/main/java/com/alibaba/fastjson/support/spring/FastJsonJsonView.java
@@ -243,7 +243,7 @@ public class FastJsonJsonView
     /**
      * Set extractValueFromSingleKeyModel.
      *
-     * @param extractValueFromSingleKeyModel
+     * @param extractValueFromSingleKeyModel extractValueFromSingleKeyModel
      */
     public void setExtractValueFromSingleKeyModel(boolean extractValueFromSingleKeyModel) {
         this.extractValueFromSingleKeyModel = extractValueFromSingleKeyModel;


Test patch:
diff --git a/core/src/test/java/com/alibaba/fastjson2/issues_2900/Issue2944.java b/core/src/test/java/com/alibaba/fastjson2/issues_2900/Issue2944.java
new file mode 100644
index 000000000..6735e7bfc
--- /dev/null
+++ b/core/src/test/java/com/alibaba/fastjson2/issues_2900/Issue2944.java
@@ -0,0 +1,65 @@
+package com.alibaba.fastjson2.issues_2900;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import lombok.Getter;
+import org.junit.jupiter.api.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class Issue2944 {
+    @Test
+    public void test() {
+        List<Employee> employees = new ArrayList<>();
+        employees.add(new Employee(0, "John"));
+        employees.add(new Employee(1, "Jane"));
+        employees.add(new Employee(2, "Bob"));
+        Department department = new Department("dev", employees);
+
+        String payload = JSON.toJSONString(department);
+        JSONObject jsonObject = JSON.parseObject(payload);
+        Department parsed = jsonObject.toJavaObject(Department.class);
+        assertEquals(payload, JSON.toJSONString(parsed));
+    }
+
+    @Getter
+    static class Department {
+        private final String name;
+        private final List<Employee> employees;
+
+        public Department(String name, List<Employee> employees) {
+            this.name = name;
+            this.employees = employees;
+        }
+
+        @Override
+        public String toString() {
+            return "Department{" +
+                    "name='" + name + '\'' +
+                    ", employees=" + employees +
+                    '}';
+        }
+    }
+
+    @Getter
+    static class Employee {
+        private final Integer id;
+        private final String name;
+
+        public Employee(int id, String name) {
+            this.id = id;
+            this.name = name;
+        }
+
+        @Override
+        public String toString() {
+            return "Employee{" +
+                    "id=" + id +
+                    ", name='" + name + '\'' +
+                    '}';
+        }
+    }
+}
diff --git a/core/src/test/java/com/alibaba/fastjson2/issues_3100/Issue3103.java b/core/src/test/java/com/alibaba/fastjson2/issues_3100/Issue3103.java
new file mode 100644
index 000000000..11e1c34ce
--- /dev/null
+++ b/core/src/test/java/com/alibaba/fastjson2/issues_3100/Issue3103.java
@@ -0,0 +1,47 @@
+package com.alibaba.fastjson2.issues_3100;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.alibaba.fastjson2.schema.JSONSchema;
+import com.alibaba.fastjson2.schema.ValidateResult;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+
+public class Issue3103 {
+    @Test
+    public void test() {
+        String objectStr = "{\n" +
+                "\t\"name\": \"John Doe\",\n" +
+                "\t\"age\": 41.5\n" +
+                "}";
+        String schemaStr = "{\n" +
+                "\t\"$defs\": {\n" +
+                "\t\t\"ageLimit\": {\n" +
+                "\t\t\t\"minimum\": 18,\n" +
+                "\t\t\t\"maximum\": 60\n" +
+                "\t\t},\n" +
+                "\t\t\"ageType\": {\n" +
+                "\t\t\t\"type\": \"integer\"\n" +
+                "\t\t}\n" +
+                "\t},\n" +
+                "\t\"type\": \"object\",\n" +
+                "\t\"properties\": {\n" +
+                "\t\t\"name\": {\n" +
+                "\t\t\t\"type\": \"string\"\n" +
+                "\t\t},\n" +
+                "\t\t\"age\": {\n" +
+                "\t\t\t\"allOf\": [{\n" +
+                "\t\t\t\t\"$ref\": \"#/$defs/ageLimit\"\n" +
+                "\t\t\t}, {\n" +
+                "\t\t\t\t\"$ref\": \"#/$defs/ageType\"\n" +
+                "\t\t\t}]\n" +
+                "\t\t}\n" +
+                "\t},\n" +
+                "\t\"required\": [\"name\"]\n" +
+                "}";
+        JSONSchema schema = JSONSchema.of(JSON.parseObject(schemaStr));
+        ValidateResult result = schema.validate(JSONObject.parseObject(objectStr));
+        assertFalse(result.isSuccess());
+    }
+}
diff --git a/core/src/test/java/com/alibaba/fastjson2/issues_3200/Issue3200.java b/core/src/test/java/com/alibaba/fastjson2/issues_3200/Issue3200.java
new file mode 100644
index 000000000..653ccb612
--- /dev/null
+++ b/core/src/test/java/com/alibaba/fastjson2/issues_3200/Issue3200.java
@@ -0,0 +1,33 @@
+package com.alibaba.fastjson2.issues_3200;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONWriter;
+import com.alibaba.fastjson2.annotation.JSONField;
+import lombok.Getter;
+import lombok.Setter;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class Issue3200 {
+    @Test
+    public void testArray() {
+        SecondMenuGroupUI secondMenuGroupUI = new SecondMenuGroupUI();
+        secondMenuGroupUI.setGroupId("group1");
+        secondMenuGroupUI.setGroupName("分组");
+        assertEquals("{\"groupId\":\"group1\",\"groupName\":\"分组\",\"secondList\":[]}", JSON.toJSONString(secondMenuGroupUI));
+    }
+
+    @Getter
+    @Setter
+    public static class SecondMenuGroupUI {
+        @JSONField(ordinal = 2)
+        private String groupName;
+        @JSONField(ordinal = 1)
+        private String groupId;
+        @JSONField(ordinal = 3, serializeFeatures = JSONWriter.Feature.WriteNullListAsEmpty)
+        private List<String> secondList;
+    }
+}
diff --git a/core/src/test/java/com/alibaba/fastjson2/issues_3300/Issue3331.java b/core/src/test/java/com/alibaba/fastjson2/issues_3300/Issue3331.java
new file mode 100644
index 000000000..95320281f
--- /dev/null
+++ b/core/src/test/java/com/alibaba/fastjson2/issues_3300/Issue3331.java
@@ -0,0 +1,18 @@
+package com.alibaba.fastjson2.issues_3300;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class Issue3331 {
+    @Test
+    public void test() {
+        String json = "[{\"priority_flag\":9,\"service_type\":\"bbb\",\"destination_addr\":\"bbb\"}]";
+        Object object1 = com.alibaba.fastjson.JSON.parse(json);
+        Object object2 = com.alibaba.fastjson2.JSON.parse(json);
+        String path = "$.service_type";
+        assertEquals(com.alibaba.fastjson.JSONPath.contains(object1, path), com.alibaba.fastjson2.JSONPath.contains(object2, path));
+        path = "$[0].service_type";
+        assertEquals(com.alibaba.fastjson.JSONPath.contains(object1, path), com.alibaba.fastjson2.JSONPath.contains(object2, path));
+    }
+}
diff --git a/core/src/test/java/com/alibaba/fastjson2/issues_3300/Issue3375.java b/core/src/test/java/com/alibaba/fastjson2/issues_3300/Issue3375.java
new file mode 100644
index 000000000..15df2746c
--- /dev/null
+++ b/core/src/test/java/com/alibaba/fastjson2/issues_3300/Issue3375.java
@@ -0,0 +1,31 @@
+package com.alibaba.fastjson2.issues_3300;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONPath;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class Issue3375 {
+    @Test
+    public void test() {
+        String json = "{\n" +
+                "\t\"name\": \"\",\n" +
+                "\t\"value\": [{\n" +
+                "\t\t\"id\": \"101\",\n" +
+                "\t\t\"additionalProperty\": [{\n" +
+                "\t\t\t\t\"token\": \"token1\"\n" +
+                "\t\t\t},\n" +
+                "\t\t\t{\n" +
+                "\t\t\t\t\"token\": \"token2\"\n" +
+                "\t\t\t}\n" +
+                "\t\t]\n" +
+                "\t}]\n" +
+                "}";
+        Object object = JSON.parse(json);
+        String path = "$.value.additionalProperty[*].token";
+        JSONPath.set(object, path, "******");
+        Object extract = JSONPath.extract(JSON.toJSONString(object), path);
+        assertEquals("[\"******\",\"******\"]", JSON.toJSONString(extract));
+    }
+}
diff --git a/fastjson1-compatible/src/test/java/com/alibaba/fastjson/JSONTest.java b/fastjson1-compatible/src/test/java/com/alibaba/fastjson/JSONTest.java
index 8f3a72d79..3530a46d0 100644
--- a/fastjson1-compatible/src/test/java/com/alibaba/fastjson/JSONTest.java
+++ b/fastjson1-compatible/src/test/java/com/alibaba/fastjson/JSONTest.java
@@ -335,7 +335,7 @@ public class JSONTest {
                                 Collections.emptyList(),
                                 SerializeConfig.global,
                                 new SerializeFilter[0],
-                                JSON.DEFFAULT_DATE_FORMAT,
+                                JSON.DEFAULT_DATE_FORMAT,
                                 JSON.DEFAULT_GENERATE_FEATURE,
                                 SerializerFeature.BrowserSecure)
                 )
diff --git a/fastjson1-compatible/src/test/java/com/alibaba/fastjson/JSONWriterTest.java b/fastjson1-compatible/src/test/java/com/alibaba/fastjson/JSONWriterTest.java
index ad6359439..275879577 100644
--- a/fastjson1-compatible/src/test/java/com/alibaba/fastjson/JSONWriterTest.java
+++ b/fastjson1-compatible/src/test/java/com/alibaba/fastjson/JSONWriterTest.java
@@ -55,6 +55,6 @@ public class JSONWriterTest {
         assertTrue(context.isEnabled(com.alibaba.fastjson2.JSONWriter.Feature.BeanToArray));
 
         writer.config(SerializerFeature.WriteDateUseDateFormat, true);
-        assertEquals(JSON.DEFFAULT_DATE_FORMAT, context.getDateFormat());
+        assertEquals(JSON.DEFAULT_DATE_FORMAT, context.getDateFormat());
     }
 }
diff --git a/fastjson1-compatible/src/test/java/com/alibaba/fastjson/TimestampTest.java b/fastjson1-compatible/src/test/java/com/alibaba/fastjson/TimestampTest.java
index 50877645b..24ccd35d0 100644
--- a/fastjson1-compatible/src/test/java/com/alibaba/fastjson/TimestampTest.java
+++ b/fastjson1-compatible/src/test/java/com/alibaba/fastjson/TimestampTest.java
@@ -22,7 +22,7 @@ public class TimestampTest {
     public void test_0() throws Exception {
         long millis = 1668216743000L;
 
-        SimpleDateFormat format = new SimpleDateFormat(JSON.DEFFAULT_DATE_FORMAT, JSON.defaultLocale);
+        SimpleDateFormat format = new SimpleDateFormat(JSON.DEFAULT_DATE_FORMAT, JSON.defaultLocale);
         format.setTimeZone(JSON.defaultTimeZone);
         String text = "\"" + format.format(new Date(millis)) + "\"";
         System.out.println(text);
@@ -34,14 +34,14 @@ public class TimestampTest {
                 "\"2022-11-12 00:00:00\"",
                 JSON.toJSONStringWithDateFormat(
                         JSON.parseObject(text, java.sql.Date.class),
-                        JSON.DEFFAULT_DATE_FORMAT
+                        JSON.DEFAULT_DATE_FORMAT
                 )
         );
         assertEquals(
                 "\"2022-11-12 09:32:23\"",
                 JSON.toJSONStringWithDateFormat(
                         JSON.parseObject(text, java.util.Date.class),
-                        JSON.DEFFAULT_DATE_FORMAT
+                        JSON.DEFAULT_DATE_FORMAT
                 )
         );
     }
diff --git a/fastjson1-compatible/src/test/java/com/alibaba/fastjson/issue_1300/Issue_for_zuojian.java b/fastjson1-compatible/src/test/java/com/alibaba/fastjson/issue_1300/Issue_for_zuojian.java
index b7cdbdaec..ef8b35eb5 100644
--- a/fastjson1-compatible/src/test/java/com/alibaba/fastjson/issue_1300/Issue_for_zuojian.java
+++ b/fastjson1-compatible/src/test/java/com/alibaba/fastjson/issue_1300/Issue_for_zuojian.java
@@ -9,21 +9,21 @@ import java.util.Date;
 public class Issue_for_zuojian {
     @Test
     public void test_for_issue() throws Exception {
-        JSON.DEFFAULT_DATE_FORMAT = "yyyyMMddHHmmssSSSZ";
+        JSON.DEFAULT_DATE_FORMAT = "yyyyMMddHHmmssSSSZ";
         String json = "{\"value\":\"20180131022733000-0800\"}";
         JSON.parseObject(json, Model.class);
-        JSON.DEFFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
+        JSON.DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
     }
 
     @Test
     public void test_for_issue_1() throws Exception {
-        JSON.DEFFAULT_DATE_FORMAT = "yyyyMMddHHmmssSSSZ";
+        JSON.DEFAULT_DATE_FORMAT = "yyyyMMddHHmmssSSSZ";
 
         String json = "{\"value\":\"20180131022733000-0800\"}";
         JSONObject object = JSON.parseObject(json);
         object.getObject("value", Date.class);
 
-        JSON.DEFFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
+        JSON.DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
     }
 
     public static class Model {
diff --git a/fastjson1-compatible/src/test/java/com/alibaba/fastjson/issue_2100/Issue2156.java b/fastjson1-compatible/src/test/java/com/alibaba/fastjson/issue_2100/Issue2156.java
index 9efdd757d..a7dc5a860 100644
--- a/fastjson1-compatible/src/test/java/com/alibaba/fastjson/issue_2100/Issue2156.java
+++ b/fastjson1-compatible/src/test/java/com/alibaba/fastjson/issue_2100/Issue2156.java
@@ -43,7 +43,7 @@ public class Issue2156 {
     @Test
     public void test_for_issue_time() throws Exception {
         java.sql.Time date = java.sql.Time.valueOf("12:13:14");
-        String str = JSON.toJSONStringWithDateFormat(date, JSON.DEFFAULT_DATE_FORMAT);
+        String str = JSON.toJSONStringWithDateFormat(date, JSON.DEFAULT_DATE_FORMAT);
         assertEquals("\"12:13:14\"", str);
     }
 }
diff --git a/fastjson1-compatible/src/test/java/com/alibaba/fastjson/issue_3100/Issue3185.java b/fastjson1-compatible/src/test/java/com/alibaba/fastjson/issue_3100/Issue3185.java
new file mode 100644
index 000000000..9d2f1f970
--- /dev/null
+++ b/fastjson1-compatible/src/test/java/com/alibaba/fastjson/issue_3100/Issue3185.java
@@ -0,0 +1,32 @@
+package com.alibaba.fastjson.issue_3100;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.junit.jupiter.api.Test;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class Issue3185 {
+    @Test
+    public void test_jsonpath_array() {
+        List list1 = new LinkedList();
+        Map map1 = new HashMap();
+        Map map2 = new HashMap();
+        map2.put("id", "123");
+        map2.put("name", "张三");
+        list1.add(map2);
+        map1.put("list1", list1);
+
+        JSONObject jsonObject = (JSONObject) JSON.toJSON(map1);
+        JSONArray jsonArray = (JSONArray) jsonObject.get("list1");
+        for (Object subJsonObject : jsonArray) {
+            assertTrue(subJsonObject instanceof JSONObject);
+        }
+    }
+}
diff --git a/fastjson1-compatible/src/test/java/com/alibaba/fastjson/issue_3300/Issue3361.java b/fastjson1-compatible/src/test/java/com/alibaba/fastjson/issue_3300/Issue3361.java
index 3219408fd..65e1f07d5 100644
--- a/fastjson1-compatible/src/test/java/com/alibaba/fastjson/issue_3300/Issue3361.java
+++ b/fastjson1-compatible/src/test/java/com/alibaba/fastjson/issue_3300/Issue3361.java
@@ -22,7 +22,7 @@ public class Issue3361 {
 
     @BeforeEach
     public void setUp() throws Exception {
-        ORIGIN_JSON_DEFAULT_DATE_FORMAT = JSON.DEFFAULT_DATE_FORMAT;
+        ORIGIN_JSON_DEFAULT_DATE_FORMAT = JSON.DEFAULT_DATE_FORMAT;
     }
 
     @Test
@@ -34,8 +34,8 @@ public class Issue3361 {
         FastJsonConfig config = new FastJsonConfig();
         config.setSerializerFeatures(SerializerFeature.WriteMapNullValue);
         config.setWriteContentLength(false);
-        JSON.DEFFAULT_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS";
-        config.setDateFormat(JSON.DEFFAULT_DATE_FORMAT);
+        JSON.DEFAULT_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS";
+        config.setDateFormat(JSON.DEFAULT_DATE_FORMAT);
         String string = JSON.toJSONString(model,
                 config.getSerializeConfig(),
                 config.getSerializeFilters(),
@@ -54,7 +54,7 @@ public class Issue3361 {
 
     @AfterEach
     public void tearDown() throws Exception {
-        JSON.DEFFAULT_DATE_FORMAT = ORIGIN_JSON_DEFAULT_DATE_FORMAT;
+        JSON.DEFAULT_DATE_FORMAT = ORIGIN_JSON_DEFAULT_DATE_FORMAT;
     }
 
     @Getter
diff --git a/fastjson1-compatible/src/test/java/com/alibaba/fastjson/serializer/JSONSerializerTest.java b/fastjson1-compatible/src/test/java/com/alibaba/fastjson/serializer/JSONSerializerTest.java
index 220c3b76c..3e0165a7a 100644
--- a/fastjson1-compatible/src/test/java/com/alibaba/fastjson/serializer/JSONSerializerTest.java
+++ b/fastjson1-compatible/src/test/java/com/alibaba/fastjson/serializer/JSONSerializerTest.java
@@ -51,7 +51,7 @@ public class JSONSerializerTest {
         assertTrue(context.isEnabled(com.alibaba.fastjson2.JSONWriter.Feature.BeanToArray));
 
         writer.config(SerializerFeature.WriteDateUseDateFormat, true);
-        assertEquals(JSON.DEFFAULT_DATE_FORMAT, context.getDateFormat());
+        assertEquals(JSON.DEFAULT_DATE_FORMAT, context.getDateFormat());
     }
 
     @Test
diff --git a/fastjson1-compatible/src/test/java/com/alibaba/fastjson/v2issues/Issue2529.java b/fastjson1-compatible/src/test/java/com/alibaba/fastjson/v2issues/Issue2529.java
index ff7077458..173895559 100644
--- a/fastjson1-compatible/src/test/java/com/alibaba/fastjson/v2issues/Issue2529.java
+++ b/fastjson1-compatible/src/test/java/com/alibaba/fastjson/v2issues/Issue2529.java
@@ -10,15 +10,15 @@ import java.util.Date;
 public class Issue2529 {
     @Test
     public void test() {
-        final String format = JSON.DEFFAULT_DATE_FORMAT;
+        final String format = JSON.DEFAULT_DATE_FORMAT;
         try {
-            JSONObject.DEFFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS";
+            JSONObject.DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS";
             ResultVo rv = ResultVo.sucessReturn("测试Date转换");
             String str = JSONObject.toJSONString(rv);
             ResultVo rvnew = JSON.parseObject(str, ResultVo.class);
             System.out.println(JSONObject.toJSONString(rvnew));
         } finally {
-            JSON.DEFFAULT_DATE_FORMAT = format;
+            JSON.DEFAULT_DATE_FORMAT = format;
         }
     }