Comments (8)
from fastjson2.
很感谢您的帮助,对不起,我没能很好地讲清楚我的需求!
我的业务中关于金额(假设字段为Integer),0和null都是有意义的,没有设置Integer的值那么它将为null,设置了0就是0,当从数据库查询一条数据是如果integer没有值则为null(也是期望的序列化的默认值);
//例子A:
Bean beanA =new Bean();
beanA.setInteage(0);
//sout:
{"integer":0}
//例子B:
Bean beanA =new Bean();
beanA.setInteage(null);
//sout:
{"integer":null}
用一句话来总结就是我只想某个类的序列化效果是注释掉fastJsonConfig中的JSONWriter.Feature.WriteNullNumberAsZero的样子,而现在的情况是全局配置的优先级貌似高于我自己的实现了!
from fastjson2.
from fastjson2.
调用toJsonString的话是可以的,但是我在调用接口时会得到不一致的结果
from fastjson2.
可以提供简单的复现用例吗?
from fastjson2.
fastjson2-test.zip
我上传了一个压缩包,一个springboot项目,您可以通过TestController中的接口测试,非常感谢大佬的帮助!
from fastjson2.
Related Issues (20)
- 无法解析不可见字符 HOT 1
- [QUESTION]Spring boot集成了FastJson2后,有没有什么好的方法动态处理时区 HOT 3
- [QUESTION] with preset Content-Type 'null'
- [BUG]NullPointerException was found in 2.0.43,ObjectReaderBean.checkAutoType0(ObjectReaderBean.java:182) HOT 3
- 2.0.44 数字过长导致负数转换为整数的bug HOT 3
- [FEATURE] github.io页面表格没有正确渲染
- 感觉太奇怪了,字段orderNumber会变成outerNumber HOT 4
- [QUESTION]JSONObject.toJSON转换问题 HOT 3
- [BUG] fastjson2执行$.节点..遍历数据时返回重复数据 HOT 8
- [QUESTION]线程中序列化导致stack中存在大量的Long对象无法清除 HOT 2
- [BUG] JSONPath使用ofJSONB读取部分byte[]的数据功能不完善 HOT 5
- [QUESTION]fastjson序列化生成$ref的引用后,如何在解析的时候将$ref再解析为jsonobject呢
- [BUG] fastjson2生成有$ref引用关系的数据序列化到文件后,解析json文件,不能转换为引用的对象,仍然是$ref HOT 12
- [QUESTION] HOT 1
- Caused by: com.alibaba.fastjson2.JSONException: illegal fieldName input6, offset 69, character 6, line 4, column 26, fastjson-version 2.0.44 HOT 4
- [BUG] 升级到 2.0.39 以及更新的版本 JSON.toJSON 报错 HOT 6
- [BUG] JSONPath.set()空指针异常 HOT 1
- [BUG]fastjson2 在反序列化列表对象存在引用关系时,存在数据数组越界或者数据丢失的问题。 HOT 2
- [BUG] fastjson2中jsonpath表达式嵌套执行报错 HOT 1
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.