application / json和application / x-www-form-urlencoded中的差异 [英] differences in application/json and application/x-www-form-urlencoded

查看:497
本文介绍了application / json和application / x-www-form-urlencoded中的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


request.ContentType =application / json; charset = utf-8之间的区别是什么?

request.ContentType = "application/json; charset=utf-8";


webRequest.ContentType = 应用程序/ x WWW的形式进行了urlencoded;

webRequest.ContentType = "application/x-www-form-urlencoded";


推荐答案

第一种情况是告诉Web服务器您正在发布JSON数据,如:

The first case is telling the web server that you are posting JSON data as in:

{ Name : 'John Smith', Age: 23}

第二个选项是告诉Web服务器您将在URL中对参数进行编码,如下所示:

The second option is telling the web server that you will be encoding the parameters in the URL as in:

Name=John+Smith&Age=23

这篇关于application / json和application / x-www-form-urlencoded中的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆