application/json和application/x-www-form-urlencoded有什么区别? [英] What are the differences between application/json and application/x-www-form-urlencoded?

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

问题描述

两者之间有什么区别

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

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

webRequest.ContentType ="application/x-www-form-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 case is telling the web server that you will be encoding the parameters in the URL:

Name=John+Smith&Age=23

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

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