[英]Json is not validating with file content?
I have tested my json data with normal content that is working fine. 我已经用正常的内容测试了我的json数据,效果很好。
S ample data as below: 足够的数据如下:
{
"language": "XYZ",
"content": {
"GEN": "this is test",
"EXO": "this is test"
}
}
{
"language": "XYZ",
"content": {
"GEN": "\id GEN\n\c 1\n\p\n\v 1 In the beginning God created the heavens and the earth.\n\v 2 And the earth was without form and was void form.",
"EXO": "\id EXO\n\c 1\n\p\n\v 1 Now these are the names of the children of Israel, which came to Egypt; every man and his household came with Jacob\n\v 2 Reuben, Simeon, Levi, and Judah"
}
}
Check screenshot for working and not working json 检查屏幕快照是否正常工作
JSON唯一允许的反斜杠转义序列是\\b
, \\f
, \\n
, \\r
, \\t
和\\"
。反斜杠的所有其他用法都必须转义为\\\\
。问题是\\i
(以及某些其他转义序列)对JSON毫无意义,因此是语法错误,请\\\\i
为\\\\i
。
For the escape sequences, you can convert your object into JSON string and then parse like below this 对于转义序列,您可以将对象转换为JSON字符串,然后按如下所示进行解析
var obj= {
"language": "XYZ",
"content": {
"GEN": "\id GEN\n\c 1\n\p\n\v 1 In the beginning God created the heavens and the earth.\n\v 2 And the earth was without form and was void form.",
"EXO": "\id EXO\n\c 1\n\p\n\v 1 Now these are the names of the children of Israel, which came to Egypt; every man and his household came with Jacob\n\v 2 Reuben, Simeon, Levi, and Judah"
}
};
var json= JSON.stringify(obj);
This will be more simple to you. 这对您来说将更加简单。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.