alibaba / alibaba/fastjson2

[QUESTION] fastjson 2.0.39 JSONFeature.SupportAutoType标识为deprecated

Open
#2,178 4 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Java
Stars
4.4k
Forks
613
Avg merge
1d 22h
Merged PRs (30d)
6

Description

请问一下,现在是不需要使用这个枚举了吗?还是说要换为其他的。 这是我json2序列化的 读写代码

@Override
public byte[] serialize(T t) throws SerializationException {
if (t == null) {
return new byte[0];
}
return JSON.toJSONString(t, JSONWriter.Feature.WriteClassName,
JSONWriter.Feature.FieldBased,
JSONWriter.Feature.WriteBigDecimalAsPlain,
JSONWriter.Feature.WriteNameAsSymbol,
JSONWriter.Feature.WriteLongAsString,
JSONWriter.Feature.LargeObject
)
.getBytes(DEFAULT_CHARSET);
}

@Override
public T deserialize(byte[] bytes) throws SerializationException {
if (bytes == null || bytes.length <= 0) {
return null;
}
String str = new String(bytes, DEFAULT_CHARSET);
return JSON.parseObject(str, clazz, autoTypeFilter,
JSONReader.Feature.FieldBased,
JSONReader.Feature.SupportAutoType
);
}

Contributor guide

Open the contributing guide

Research direction

Review the fastjson2 2.0.39 API around JSONFeature.SupportAutoType and the JSON.toJSONString and JSON.parseObject calls shown in the issue. Clarify whether the deprecated feature should remain in this serialization path or what replacement is expected, then document the supported usage and verify it against the relevant API behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.