惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

AI
AI
TaoSecurity Blog
TaoSecurity Blog
H
Heimdal Security Blog
Help Net Security
Help Net Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Microsoft Azure Blog
Microsoft Azure Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Google DeepMind News
Google DeepMind News
爱范儿
爱范儿
The Cloudflare Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
人人都是产品经理
人人都是产品经理
大猫的无限游戏
大猫的无限游戏
N
News | PayPal Newsroom
V2EX - 技术
V2EX - 技术
博客园 - 【当耐特】
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
Secure Thoughts
C
CERT Recently Published Vulnerability Notes
罗磊的独立博客
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Privacy & Cybersecurity Law Blog
有赞技术团队
有赞技术团队
S
Schneier on Security
S
SegmentFault 最新的问题
Google Online Security Blog
Google Online Security Blog
H
Hacker News: Front Page
The Last Watchdog
The Last Watchdog
Schneier on Security
Schneier on Security
PCI Perspectives
PCI Perspectives
IT之家
IT之家
Project Zero
Project Zero
博客园 - 司徒正美
P
Privacy International News Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Jina AI
Jina AI
Security Latest
Security Latest
Hacker News - Newest:
Hacker News - Newest: "LLM"
腾讯CDC
C
CXSECURITY Database RSS Feed - CXSecurity.com
阮一峰的网络日志
阮一峰的网络日志
C
Check Point Blog
aimingoo的专栏
aimingoo的专栏
V
Vulnerabilities – Threatpost
W
WeLiveSecurity
NISL@THU
NISL@THU
Webroot Blog
Webroot Blog
N
Netflix TechBlog - Medium
L
Lohrmann on Cybersecurity

博客园 - 山不转水转...

Windbg的First chance exception WPF 文本框焦点导致的内存泄露问题 产品功能被像素级抄袭了。我们拿什么来保护原创的产品设计? 显示器文字发虚的一种原因 HttpClient + IIS压缩动态内容 Windows 上第一款全局轮盘菜单软件(鼠标党进) C# Async Await 注意事项 MVC6的内置ActionResult类型 共享一个在线代码片段收集服务 清除ASPX页面中的meta:resourceKey="[a-zA-Z0-9]+" MVC 多语言记录1 设置默认的ResourceType knockoutjs with绑定导致unobtrusive validation失效的问题 查询SQL Server中所有数据库的数据文件位置 那些年,我做共享软件(3)完结 那些年,我做共享软件(2) 那些年,我做共享软件(1) URTracker事务跟踪系统在软件企业中的应用 浅析缺陷管理系统URTracker 问题跟踪软件URTracker和Windows域的集成
将long数字序列化为json时,转换为字符串
山不转水转... · 2015-02-20 · via 博客园 - 山不转水转...

2015-02-20 16:44  山不转水转...  阅读(3172)  评论(1)    收藏  举报

由于javascript中所有数字都是64位的浮点数,所以整数只能精确的表示53bit长的数字。

在从server得到的json数据中,有ID是长整数类型,在客户端根据此ID生成的link也是不准确的。

办法1是后端ViewModel中ID都改为string类型,但是这种方式会需要在后台进行大量的转换,不是很方便。

方法2:在mvc的action进行json输出的时候,将long类型的属性直接输出为字符串。

实现方法参考:

http://stackoverflow.com/questions/17369278/convert-long-number-as-string-in-the-serialization

http://stackoverflow.com/questions/26393466/how-to-add-camelcasepropertynamescontractresolver-in-startup-cs