We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
byte[]转成jsonString后,fastjson可以解析出来,fastjson2解析则报错。 请见下面的截图。
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
可以文本的方式提供testcase么?
import com.alibaba.fastjson.serializer.SerializerFeature; import java.util.Arrays; public class Main { public static void main(String[] args) { // 构造数据 byte[] data = new byte[3]; data[0] = 1; data[1] = 2; data[2] = 3; // 老版本会将数据转成jsonString并放到redis里面 String jsonString = com.alibaba.fastjson.JSONObject.toJSONString(data, SerializerFeature.WriteClassName, SerializerFeature.NotWriteDefaultValue); // 老版本使用fastjson解析数据,可以拿到数据 System.out.println("fastjson解析获得数据:" + Arrays.toString((byte[]) com.alibaba.fastjson.JSON.parse(jsonString))); // 新版本使用fastjson2解析数据,会报错 System.out.println("fastjson2解析获得数据:" + Arrays.toString((byte[]) com.alibaba.fastjson2.JSON.parse(jsonString))); } }
No branches or pull requests
问题描述
byte[]转成jsonString后,fastjson可以解析出来,fastjson2解析则报错。
请见下面的截图。
环境信息
The text was updated successfully, but these errors were encountered: