Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JSON格式的HTML字符串_Json - Fatal编程技术网

JSON格式的HTML字符串

JSON格式的HTML字符串,json,Json,我知道在你的JSON中使用html不是最好的主意,但遗憾的是,我无法控制这个数据库或这个网站,也没有获得这些特权!我正在制作谷歌地图标记,其中一个值破坏了数据,没有得到正确的处理。我知道问题出在DESC值中,是否有某种字符未转义?因为除此之外,JSON中几乎所有其他对象都可以正常工作 {"PHONE":"847-509-2000”, "LAT":42.15223, "STATE":"IL”, "ZIP":60015.0, "NAME":"DC Sarnies”, "DESC":"Opening

我知道在你的JSON中使用html不是最好的主意,但遗憾的是,我无法控制这个数据库或这个网站,也没有获得这些特权!我正在制作谷歌地图标记,其中一个值破坏了数据,没有得到正确的处理。我知道问题出在DESC值中,是否有某种字符未转义?因为除此之外,JSON中几乎所有其他对象都可以正常工作

{"PHONE":"847-509-2000”,
"LAT":42.15223,
"STATE":"IL”,
"ZIP":60015.0,
"NAME":"DC Sarnies”,
"DESC":"Opening in early May 2011, D.C. Sarnies is a contemporary but casual restaurant
specializing in sandwiches and classic American food with a twist. As well as a 
restaurant, we serve as a research and development kitchen for its parent company, 
Highland Baking Company. Guest chefs and bakery clients will have the opportunity to try 
out new products and let diners provide feedback on the dishes. The menu at D. C. Sarnies 
has something for everyone with a wide variety of appetizers, soups, salads, entrees and 
signature sandwiches and burgers to choose from. A full bar also gives diners a wide range 
of craft beers including more than 25 on tap, wine and cocktails. For more information 
visit us on Facebook at D.C. Sarnies or on Twitter DC_Sarnies.”,
"LONG":-87.84241,
"CITY":"Deerfield”,
"ADDR":"649 Lake Cook Road”,
"PHOTO":"DCcrabcakeburger.jpg”}]
jsonlint错误消息:第74行的分析错误: …02,描述:在马萨诸塞州早期开业 -----------^
应为“STRING”、“NUMBER”、“NULL”、“TRUE”、“FALSE”、“{'、['”

值末尾的双引号是问题所在。它们是错误的字符。

使用此网站验证JSON


这里的问题是用于字符串的结束引号,它们无效。

有几个问题:

使用了不同的引号。”与。 不会转义多行。如果需要换行符,请使用\n。否则,只需换行一行即可 最后的额外费用不应该在那里 这是您应该拥有的:


双引号结束错误。Rest一切正常工作。

此外,我在该示例中没有看到任何HTML,只有文本和其他正常数据。HTML在哪里?一些对象确实有HTML,但这是它崩溃的对象在引号问题之后,您还必须确保删除或替换描述中的换行符属性。我添加了从JSON lint中得到的错误,我很困惑,因为它是一个实际的字符串,所以解析为什么会认为不是这样?字符串中有换行符,这会导致JSON无效。您需要删除它们,或者用\n替换它们,所以我修复了所有的换行符,但在jsonlint上,由于某种原因,它eally不想了解更多信息,请访问Facebook上的D.C.Sarnies或Twitter@DC_Sarnies。\r\n\r\n知道为什么吗?据我所知,这并没有什么错,前提是所有这些都用双引号括起来。错误可能在其他地方。
{
    "PHONE": "847-509-2000",
    "LAT": 42.15223,
    "STATE": "IL",
    "ZIP": 60015,
    "NAME": "DC Sarnies",
    "DESC": "Opening in early May 2011, D.C. Sarnies is a contemporary but casual restaurant specializing in sandwiches and classic American food with a twist. As well as a  restaurant, we serve as a research and development kitchen for its parent company,  Highland Baking Company. Guest chefs and bakery clients will have the opportunity to try  out new products and let diners provide feedback on the dishes. The menu at D. C. Sarnies  has something for everyone with a wide variety of appetizers, soups, salads, entrees and  signature sandwiches and burgers to choose from. A full bar also gives diners a wide range  of craft beers including more than 25 on tap, wine and cocktails. For more information  visit us on Facebook at D.C. Sarnies or on Twitter DC_Sarnies.",
    "LONG": -87.84241,
    "CITY": "Deerfield",
    "ADDR": "649 Lake Cook Road",
    "PHOTO": "DCcrabcakeburger.jpg"
}