I need some advice/ help on how to remove special character in html
I need to remove the special character: "kind": "pagespeedonline#result". I already try some code to move it but can't.
I wanted the result to be kind: pagespeedonline#result
I want those quotation mark(") to be remove and become just plain text
"kind":"pagespeedonline#result",
"id": "https://www.example.com/",
"responseCode": 200,
"title": "",
"score": 55,
"pageStats": {
"numberResources": 93,
"numberHosts": 22,
"totalRequestBytes": "19710",
"numberStaticResources": 62,
"htmlResponseBytes": "289086",
"cssResponseBytes": "503970",
"imageResponseBytes": "467782",
"javascriptResponseBytes": "1279195",
"otherResponseBytes": "202171",
"numberJsResources": 28,
"numberCssResources": 11.
答案 0 :(得分:0)
这是一个包含JSON格式数据的字符串。 使用PHP显示带有双引号的一个元素:
$data = ''; // your JSON data here
$json = json_decode($data, true);
echo 'kind: '.$json['kind'];
使用JavaScript:
var data = {
"kind":"pagespeedonline#result",
"id": "https://www.example.com/",
"responseCode": 200,
"title": "",
"score": 55,
"pageStats": {
"numberResources": 93,
"numberHosts": 22,
"totalRequestBytes": "19710",
"numberStaticResources": 62,
"htmlResponseBytes": "289086",
"cssResponseBytes": "503970",
"imageResponseBytes": "467782",
"javascriptResponseBytes": "1279195",
"otherResponseBytes": "202171",
"numberJsResources": 28,
"numberCssResources": 11
}
};
alert('kind: ' + data.kind);
// this will display JSON data converted to string with removed double quotation marks
alert(JSON.stringify(data, null, 4).replace(/\"/g, ""));