JSON有效字符 [英] JSON Valid Chars

查看:103
本文介绍了JSON有效字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在JSON响应的上下文中,双引号中的\'是否存在无效"? 有确定的JSON规范可以给我答案吗?

Is the presence of a \' within double quotes "invalid" in the context of a JSON response? Is there a definitive JSON spec that could give me an answer?

推荐答案

查看 http://www.json.org /并向下滚动到字符串"图.

Check out http://www.json.org/ and scroll down to the "String" diagram.

您可以在那里看到\如何成为控制"字符.如果要在JSON中使用文字反斜杠,则需要对其进行转义:例如,"\\"是有效的JSON字符串.

You can see there how the \ is a "control" character. If you want a literal backslash within your JSON, you'll need to escape it: "\\" is a valid JSON string, for example.

这篇关于JSON有效字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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