-
Notifications
You must be signed in to change notification settings - Fork 546
Closed
Labels
Milestone
Description
问题描述
简要描述您碰到的问题。
使用此api 解析json时
JSONObject jsonObject4 = JSONObject.parseObject(json2)
出现 JSONException: not support - 异常
环境信息
请填写以下信息:
- OS信息: [e.g.:Win11 i7 32g]
- JDK信息: [e.g.:Oracle1.8.0_401]
- 版本信息:[e.g.:Fastjson2 2.0.55]
重现步骤
如何操作可以重现该问题:
- 使用
JSONObject.parseObject方法 - 输入
{"*/*":{"schema":{"$ref":"Error-ModelName{namespace='javax.servlet.http', name='HttpServletResponse'}"}}}数据 - 出现
com.alibaba.fastjson2.JSONException: not support -错误
String json2 = "{\"*/*\":{\"schema\":{\"$ref\":\"Error-ModelName{namespace='javax.servlet.http', name='HttpServletResponse'}\"}}}";
JSONObject jsonObject4 = JSONObject.parseObject(json2);期待的正确结果
正常解析不出现异常
相关日志输出
Exception in thread "main" com.alibaba.fastjson2.JSONException: not support -
at com.alibaba.fastjson2.JSONPathParser.parse(JSONPathParser.java:109)
at com.alibaba.fastjson2.JSONPath.of(JSONPath.java:475)
at com.alibaba.fastjson2.JSONReader.readObject(JSONReader.java:2428)
at com.alibaba.fastjson2.JSONReader.read(JSONReader.java:2219)
at com.alibaba.fastjson2.JSON.parseObject(JSON.java:348)
at com.alibaba.fastjson2.JSONObject.parseObject(JSONObject.java:2021)
at com.work.json.ParseJsonMain.main(ParseJsonMain.java:24)
*