为什么一个URL的JSON数组返回为无效?

问题描述 投票:0回答:1

这是我的JSON,返回的是 "无效JSON"。

["http://4x4forever.com", "http://www.4xfools.com", "http://www.4play-4wheelers.com/", "http://www.ci4wi.org/portal2/", "http://www.erieshoresjeeps.com/", "http://firewalker4x4.org/", "http://www.wegotmud.com/", "http://ironhorse4x4s.com/", "http://www.kifourwheelers.com/forum/"]

我猜想这和斜杠和双斜杠有关。但即使我这样转义,还是不行。

[\"http:\/\/4x4forever.com\", \"http:\/\/www.4xfools.com\", \"http:\/\/www.4play-4wheelers.com\/\", \"http:\/\/www.ci4wi.org\/portal2\/\", \"http:\/\/www.erieshoresjeeps.com\/\", \"http:\/\/firewalker4x4.org\/\", \"http:\/\/www.wegotmud.com\/\", \"http:\/\/ironhorse4x4s.com\/\", \"http:\/\/www.kifourwheelers.com\/forum\/\"]

斜线和双斜线需要转义吗?我读到的是 回答 JSON可以让你避开斜线,但这是不必要的。

json escaping character slash
1个回答
0
投票

错误的出现是因为你在转义 "離開 " 照样可以

["http:\/\/4x4forever.com", "http:\/\/www.4xfools.com", "http:\/\/www.4play-4wheelers.com\/", "http:\/\/www.ci4wi.org\/portal2\/", "http:\/\/www.erieshoresjeeps.com\/", "http:\/\/firewalker4x4.org\/", "http:\/\/www.wegotmud.com\/", "http:\/\/ironhorse4x4s.com\/", "http:\/\/www.kifourwheelers.com\/forum\/"]
© www.soinside.com 2019 - 2024. All rights reserved.