Skip to content
This repository was archived by the owner on Jul 29, 2026. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/test/java/com/alibaba/fastjson/serializer/TestParse.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.parser.ParserConfig;
import org.junit.Before;
import org.junit.Test;

Expand All @@ -28,9 +29,11 @@ public void prepareJsonString() {

@Test
public void testParse() {
logger.info("parsing json string:" + jsonString);
TestBean testBean = (TestBean) JSON.parse(jsonString);
assert testBean.getData() != null;
logger.info("parsing json string:" + jsonString);
final ParserConfig parserConfig = new ParserConfig();
parserConfig.setAutoTypeSupport(true);
TestBean testBean = (TestBean) JSON.parse(jsonString, parserConfig);
assert testBean.getData() != null;
assert "tester".equals(testBean.getName());
assert "value".equals(testBean.getData().getString("key"));
}
Expand Down