Comments (7)
这个 usingName 是指 Enum.name()
from fastjson2.
这个 usingName 是指 Enum.name()
但是WriteEnumsUsingName在jdk 1.8中会使用@JSONField中的name属性输出
from fastjson2.
这个 usingName 是指 Enum.name()
但是WriteEnumsUsingName在jdk 1.8中会使用@JSONField中的name属性输出
🤔表现不一致?这是个问题
from fastjson2.
这个 usingName 是指 Enum.name()
但是WriteEnumsUsingName在jdk 1.8中会使用@JSONField中的name属性输出
🤔表现不一致?这是个问题
是的, 表现不一致才提出的issue
from fastjson2.
@Test
fun test() {
var str = JSON.toJSONString(Type.ACCEPTED, JSONWriter.Feature.WriteEnumsUsingName)
assertEquals("\"Accepted\"", str)
assertEquals(Type.ACCEPTED, JSON.parseObject(str, Type::class.java))
}
enum class Type {
@JSONField(name = "Accepted")
ACCEPTED,
@JSONField(name = "Pending")
PENDING,
@JSONField(name = "Rejected")
REJECTED
}
问题没有重现啊
from fastjson2.
var str = JSON.toJSONString(Type.ACCEPTED, JSONWriter.Feature.WriteEnumsUsingName)
jdk 17以上的版本打印输出的为"ACCEPTED", 预期输出为"Accepted"
from fastjson2.
我测试过JDK 17也是对的啊
from fastjson2.
Related Issues (20)
- [QUESTION]怎么自定义JSONReader.Feature HOT 2
- fastjson2 在对LinkedHashMap做toJSONString时指定JSONWriter.Feature.MapSortField无效 HOT 8
- [FEATURE] ThreadLocal handling with Virtual Threads (JDK21) HOT 1
- [BUG] Fastjson2 针对循环链接JSON.toJSONString 会抛异常 HOT 2
- [BUG]相同代码fastjson1升级到fastjson2之后出现内存溢出错误 HOT 2
- [QUESTION]Could not write JSON: JSON#writeTo cannot serialize 'XXX' to 'OutputStream'; HOT 1
- [BUG]LocalDateTime 序列化失败 & locale 不生效 HOT 7
- 枚举类型自定义反序列化,调用readObejct时传入targetClass,用于反序列化具体的枚举[FEATURE] HOT 2
- [BUG] 使用JSONB解析带Jackson @JsonFormat 注解的Timestamp类会报错 HOT 5
- [BUG] 直接反序列化URL字符串报错 HOT 2
- [QUESTION] JSON.parse后,1.2.83版本没问题,2.0.47报错 HOT 2
- [QUESTION]1.2.83的JSONObject.parseArray方法,升级到2.x系列后用什么 HOT 1
- [QUESTION]fastjson2 解析Gson的@SerializedName 有开关关闭吗 HOT 4
- [BUG]关于jsonDirect=true报错 HOT 2
- [BUG],序列化再反序列化,重复引用的对象不能正确反序列化 HOT 5
- [BUG],SupportSmartMatch全局配置无效 HOT 2
- [BUG] 在 @JSONField下配置了 JSONReader.Feature.FieldBased 无效 HOT 3
- [BUG] 序列化巨大对象时OOM HOT 1
- [BUG] Cannot make a java.lang.Class constructor accessible HOT 3
- [BUG] java.util.ConcurrentModificationException HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastjson2.