json的存在意义(json和String的区别)
json
适用于现代 C++ 的 JSON。
项目地址:https://gitcode.com/gh_mirrors/js/json

·
我一直不太明白json是个什么东西,虽然一直用,但总感觉json跟String有些微妙的相似感,要说为了进行程序间的数据传递吧,但Java程序中用“@responsebody”标签最后传递的好多都是“return JSON.toJSONString(resultMap)”,那你干脆创建一个String对象传过去得了,非得“json转String”,不是多此一举吗?
后来查资料看大家的意见,发现这感觉跟“int转String,String转double”等有些微妙的相似,我们把“int转String”为了什么,还不是为了使用String类的某些功能,还有“父类转子类(instance of)”,同样是为了让父类使用子类有而父类没有的方法;
String字符串:var str1 = '{ "name": "cxh", "sex": "man" }';
JSON对象:
var str2 = { "name": "cxh", "sex": "man" };
那明明一种形式能用String表示,干嘛非得费劲地整成json格式呢?-----那是因为json在获取内容方面比String更方便:
如果你在前台使用,那么Json对象可以通过xx.name来调用获取;如果是字符串,那就只能是字符串,你就只能各种切割各种分组获得name,数据一多看不切割死你,烦不胜烦... ...
json
适用于现代 C++ 的 JSON。
项目地址:https://gitcode.com/gh_mirrors/js/json
--------------------------------------------------------------------------------------------
ajax的dataType属性,我一直以为是为了约束"发送给服务器的data"的数据类型的,今天再一看,原来是为了约束服务器的返回值类型,而data的数据类型ajax定死了为Object或String... ...
推荐内容




适用于现代 C++ 的 JSON。
最近提交(Master分支:6 个月前 )
11aa5f94
* Make std::filesystem::path conversion to/from UTF-8 encoded JSON string explicit.
Signed-off-by: Richard Musil <risa2000x@gmail.com>
* Experimental: Changing C++ standard detection logic to accommodate potential corner cases.
Signed-off-by: Richard Musil <risa2000x@gmail.com>
* Drop C++ standard tests for compilers which do not implement required features.
Signed-off-by: Richard Musil <risa2000x@gmail.com>
* Drop C++ standard tests for MSVC versions which do not implement required features.
Signed-off-by: Richard Musil <risa2000x@gmail.com>
---------
Signed-off-by: Richard Musil <risa2000x@gmail.com>
Co-authored-by: Richard Musil <risa2000x@gmail.com> 1 天前
79587f89
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.6.10 to 9.6.11.
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.6.10...9.6.11)
---
updated-dependencies:
- dependency-name: mkdocs-material
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 2 天前
更多推荐
相关推荐
查看更多
json

适用于现代 C++ 的 JSON。
json

An efficient JSON decoder
json

A free, in-browser JSON to CSV converter.
所有评论(0)