remove double quotes from Json return data using Jquery

前端 未结 8 2113
半阙折子戏
半阙折子戏 2020-12-08 06:29

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.         


        
8条回答
  •  误落风尘
    2020-12-08 07:17

    The stringfy method is not for parsing JSON, it's for turning an object into a JSON string.

    The JSON is parsed by jQuery when you load it, you don't need to parse the data to use it. Just use the string in the data:

    $('div#ListingData').text(data.data.items[0].links[1].caption);
    

提交回复
热议问题