How to set formatting with JavaScriptSerializer when JSON serializing?(JSON序列化时如何使用JavaScriptSerializer设置格式?)
问题描述
我正在使用 JavaScriptSerializer 将对象序列化为 JSON 格式的文件.但是结果文件没有可读的格式.如何允许格式化以获得可读文件?
I am using JavaScriptSerializer for serializing objects to the file to the JSON format. But the result file has no readable formatting. How can I allow formating to get a readable file?
推荐答案
好像没有内置工具来格式化 JSON-serializer 的输出.
我想发生这种情况的原因是减少了我们通过网络发送的数据.
It seemed to be that there is no built-in tool for formatting JSON-serializer's output.
I suppose the reason why this happened is minimizing of data that we send via network.
您确定在代码中需要格式化数据吗?或者您只想在调试期间分析 JSON?
Are you sure that you need formatted data in code? Or you want to analize JSON just during debugging?
提供此类功能的在线服务有很多:1、2.或独立应用程序:JSON 查看器.
There is a lot of online services that provide such functionality: 1, 2. Or standalone application: JSON viewer.
但如果您需要在应用程序内部进行格式化,您可以编写 适当的代码 自己.
But if you need formatting inside application, you can write appropriate code by yourself.
这篇关于JSON序列化时如何使用JavaScriptSerializer设置格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:JSON序列化时如何使用JavaScriptSerializer设置格式?
基础教程推荐
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
