使用Jquery从Json返回数据中删除双引号 [英] remove double quotes from Json return data using Jquery
本文介绍了使用Jquery从Json返回数据中删除双引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用JQuery来获取Json数据,但它显示的数据有双引号。它有删除它的功能吗?
I use JQuery to get Json data, but the data it display has double quotes. It there a function to remove it?
$('div#ListingData').text(JSON.stringify(data.data.items[0].links[1].caption))
它返回:
"House"
如何删除双引用?干杯。
How can I remove the double quote? Cheers.
推荐答案
使用 replace
:
var test = "\"House\"";
console.log(test);
console.log(test.replace(/\"/g, ""));
// "House"
// House
注意结尾的 g
表示全局(全部替换) 。
Note the g
on the end means "global" (replace all).
这篇关于使用Jquery从Json返回数据中删除双引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文