2016-04-30 28 views
0

我的字符串是意外的非空格错误在解析字符串JSON对象

"\"{'Body': '<p>I have a issue : When I add a content that includes text and hyperlink, after that I use the wrapLongStringIntoMultiLine to set length of each lines. But in the special case, the end of line is in scope of hyperlink, so the hyperlink structure is broken. \\r\\r\\nHere is my code :</p>\\r\\r\\n\\r\\r\\n<pre><code>String languages=\"\" Deutsch, English (All), English (United Kingdom), Bahasa Indonesia, Italiano &lt;a href=\\\\\"\"\\\\\"\"&gt; edit&lt;/a&gt;\"\";\\r\\r\\n</code></pre>\\r\\r\\n\\r\\r\\n<p>after call wrapLongStringIntoMultiLine: </p>\\r\\r\\n\\r\\r\\n<pre><code>&lt;html&gt;Deutsch, English (All), English (United Kingdom),&lt;/br&gt; Bahasa Indonesia, Italiano &lt;a href&lt;br&gt;=\\\\\"\"\\\\\"\"&gt; edit&lt;/a&gt;\"\";\\r\\r\\n</code></pre>\\r\\r\\n\\r\\r\\n<p>The <code>&lt;br&gt; tag</code> exists in the scope of hyperlink. How to fix this issue? Please give me advise. Thanks</p>\\r\\r\\n', 'Title': 'Use the wrapLongStringIntoMultiLine on the Jeditor pane'}\"\r" 

我已经验证使用JSON皮棉的字符串,其显示为有效的JSON。

SyntaxError: JSON.parse: unexpected non-whitespace character afterJSON data at line 1 column 338 of the JSON data 

这是我收到的时候我使用$ .parseJSON(STR)

+0

的可能的复制[JSON.parse:之后在javascript JSON数据意外非空白字符(http://stackoverflow.com/questions/21515583/json-parse-unexpected-non-whitespace -json-data-in-javascript) – Atula

+0

这可能是最好的,你创建一个https://jsfiddle.net/条目并链接它,让人们可以工作瓦特/它给你一个解决方案。 – Dale

+0

尝试在您的JSON字符串中替换您的\“&#146,这就是JQuery窒息的原因。 – Dale

回答

0

按我的观察,我发现,有错误“:”在你的绳子,让JSON是无法理解的是特别的事情,让你的字串说,

I have a issue : When I add a content... 

,所以我想建议你试试“ - ”而不是“:”

为例如,

I have a issue - When I add a content...