alibaba / fastjson

FASTJSON 2.0.x has been released, faster and more secure, recommend you upgrade.
https://github.com/alibaba/fastjson2/wiki/fastjson_1_upgrade_cn
Apache License 2.0
25.72k stars 6.5k forks source link

SnakeCase风格怎么配置? #3735

Open gezhonglunta opened 3 years ago

gezhonglunta commented 3 years ago

希望用JSON.toJSON或者JSON.parse的时候,字段的命名风格是SnakeCase 在网上找了好久没有得到答案,也不知道该去哪里提问,不得已在此提个问题 现在只知道在字段上用注解@JSONField来实现命名问题,不知道如何全局设置这个命名风格 网上有很多这样的例子: ParserConfig parserConfig = new ParserConfig(); parserConfig.propertyNamingStrategy = PropertyNamingStrategy.SnakeCase; 但是我这个版本(1.1.46.sec10)不行,没有这样的属性

Certseeds commented 3 years ago

wiki-PropertyNamingStrategy

这个也许可以解决问题