-
Notifications
You must be signed in to change notification settings - Fork 507
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix JSONObject ClassCastException, for issue #2762
- Loading branch information
1 parent
41d3a01
commit 46a5d69
Showing
2 changed files
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
fastjson1-compatible/src/test/java/com/alibaba/fastjson/v2issues/Issue2762.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.alibaba.fastjson.v2issues; | ||
|
||
import com.alibaba.fastjson.JSONObject; | ||
import org.json.JSONException; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class Issue2762 { | ||
@Test | ||
public void test() throws JSONException { | ||
String jsonString = "{\"this0\":{\"$ref\":\"1\"}}"; | ||
JSONObject jsonObject = JSONObject.parseObject(jsonString, JSONObject.class); | ||
JSONObject innerObject1 = (JSONObject) jsonObject.get("this0"); | ||
} | ||
} |