javascript - 这个 JSON 字符串有什么问题?

标签 javascript jquery json

我的 JSON 字符串如下所示,

[{"id" : "38","heading" : "Can you also figure out how to get me back the 10 hours I
sp.....","description" : "Im having a very similar problem with the Login control - again it always generates a default style containing border-collapse - only in this case .....","img_url" : "~/EventImages/EventImages1274014884460.jpg","catogory" : "News","doe" : "15-05-2010 "},

{"id" : "40","heading" : "How to remove the border of each row (from the gridview cont.....","description" : "How to remove the border of each row (from the gridview control). ? I set borderWidth to 0, and the borders are not displayed with IE, but the top a.....","img_url" : "~/EventImages/EventImages1274028613023.jpg","catogory" : "News","doe" : "15-05-2010 "},

{"id" : "41","heading" : "Realmac Software | How to fix FancyZoom popup? (pops up behi.....","description" : "The first thing we need is an options dialog, not only to make it easier for the user, but also because later we will want to launch this dialog from .....","img_url" : "~/EventImages/EventImages1274037688120.jpg","catogory" : "News","doe" : "15-05-2010 "},

{"id" : "42","heading" : "hi jacon
dsadddaddddddddddddddd","description" : "hi jacon
This is a little messy because the clientHeight/Width properties can mean different things in different browsers, and even different thi.....","img_url" : "~/EventImages/EventImages1274041211533.jpg","catogory" : "News","doe" : "15-05-2010 "}

但出现错误,

未终止的字符串文字....

编辑:

我用过这个,但没用,

 var newjson = cfreturn( """" & ToString( HfJsonValue ).ReplaceAll( "(['""\\\/\n\r\t]{1})", "\\$1" ) & """" ) ;
 var jsonObj = eval('(' + newjson + ')');

错误:参数列表后缺少 )

源代码:

var newjson = cfreturn( """" & ToString( HfJsonValue ).ReplaceAll( "(['""\\\/\n\r\t]{1})", "\\$1" ) & """" ); 

编辑:

JSON 字符串中有一个 ' 标记导致问题...任何建议

最佳答案

玩弄 JSONLint 后,我发现以下两个问题:

  1. 换行符需要使用 \\n 进行转义。
  2. 您缺少终端]

关于javascript - 这个 JSON 字符串有什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2847230/

相关文章:

用于验证电子邮件地址的 JavaScript/Jquery RegEx 无法正常工作

javascript - 如何在 Angular 中定义 HTML block 的范围?

javascript - Jquery keydown 不会丢失任何东西

javascript - 使用 javascript 验证用户输入

javascript - 在通过 className 加载 dom 后如何设置事件监听器

c# - DataContractJsonSerializer 人类可读的 json

java - 序列化 Jackson JSON 树模型时排除 NullNode

java - Jackson 使用可选字段的默认值反序列化记录

javascript - 将项目添加到模型并刷新第二次 ng-repeat

javascript - 在javascript中分割这个的逻辑?