rest - GET with body (json format), what to do with apostrophe?
问题描述
I am new to REST. I have a client who tries call an api I have running. Problem is that they use some type of builder to create the body.
In my endpoint, I expect name
field in the body like this:
{
"name": [
{ "tag": "1", "value": "O'Bryan" },
...
But client sends something like this:
{
'name': [
{'tag': '1 ', 'value': 'O'Bryan'}
It works except when name has apostrophe. I am wondering if this body will still valid. If not, what can they do to fix it without using double quote(")?
解决方案
This body will not be valid, you would need to escape the single quote like so \'
推荐阅读
- iframe - 延迟加载 youtube iframe 但继续关注播放/暂停按钮?
- microservices - 在微服务架构中搜索 API 网关
- sql - SQL 性能:将一张表插入两张
- html - 如何从另一个 css 文件导入 css 根常量
- python - Python:获取两个元组交集的更有效方法?
- android - 使用 async & await 从房间数据库中获取数据
- android - 带有 ItemTouchHelper.SimpleCallback 的对象
- flutter - Flutter 如何发出实时请求
- reactjs - 在函数反应钩子中访问函数参数
- reactjs - 未捕获在状态树中找不到路由器减速器,它必须安装在“路由器”下