fix bug for issue #3719 (#3721)

This commit is contained in:
jujn 2025-08-17 20:18:06 +08:00 committed by GitHub
parent 08c2f3089d
commit 92bd063907
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 0 deletions

View File

@ -160,6 +160,10 @@ public final class ObjectReaderImplObject
break;
}
if (jsonReader.current() == '/') {
jsonReader.skipComment();
}
Object name;
if (i == 0 && typeName == null && hash != 0) {
name = jsonReader.getFieldName();

View File

@ -0,0 +1,18 @@
package com.alibaba.fastjson2.issues_3700;
import com.alibaba.fastjson2.JSONArray;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class Issue3719 {
@Test
public void test() {
assertEquals("[{\"a\":700000,\"b\":1}]", JSONArray.parse("[{\n" +
" // 注释a\n" +
" \"a\":700000, \n" +
" // 注释b\n" +
" \"b\":1 \n" +
" }]").toString());
}
}