-3

I am doing my Javascript. And just imported JSON and printed it out with JSON.stringfy I am using that site because the JSON contains the URL which I want to link. I am not getting what I really need as the output.

description": "www.site.com" 

This is what I get in my console:

"www.site.com"

This is what I actually want, and remove the quotes.

www.site.com

Please help!

Pranav Bhattad
  • 13
  • 1
  • 1
  • 4

2 Answers2

0

Am not sure what your requirement is but you can do this. Try Replace function;

const obj = {description: "www.site.com"};
JSON.stringify(obj.description).replace(/"/g,"");
ThivankaW
  • 511
  • 1
  • 8
  • 21
-1
var someStr = 'He said "Hello, my name is Foo"';
console.log(someStr.replace(/['"]+/g, ''));

That should do the trick... (if your goal is to replace all double quotes).