How to remove quotation marks (double quotes) from string using jQuery or Javascript?

I am working on a web-application which returns JSON results as "/FileURL", I just need to get /FileURL as a result, means I need to remove quotation marks (double quotes) from returned JSON string using jQuery or Javascript, how can I do that?

Asked by:- Vinnu
: 11694 At:- 5/29/2018 3:05:27 PM
Javascript jQuery remove double quotes

2 Answers
profileImage Answered by:- neena

You can try using regex to remove quotes from your string

var strWithOutQuotes= strWithQuotes.replace(/['"]+/g, '')
  • ['"] is a character class, matches both single and double quotes. you can replace this with "to only match double quotes.
  • +: one or more quotes, chars, as defined by the preceding char-class (optional)
  • g: the global flag. This tells JS to apply the regex to the entire string. If you omit this, you'll only replace a single char.

Above solution will remove double quotes from your string.

If you just want to remove double quotes from start and end of you string you can try

var strWithOutQuotes= strWithQuotes.replace(/^"(.*)"$/, '$1');

Another way, possible the simplest example

var strWithOutQuotes= strWithQuotes.replace(/"/g, '');

here is the working fiddle of the last solution.

At:- 5/30/2018 2:48:43 PM Updated at:- 5/30/2018 2:50:22 PM
Thanks for your answer, It works as required. 0
By : Vinnu - at :- 6/4/2018 7:33:27 AM

profileImage Answered by:- Sam

If you want to remove the double quotes from JSON returned data, you can simply remove it using JSON.Parse method like below


JSON.parse("My test");  // for example

You can also do it using eval

var No_Quotes_string= eval(Quoted_string);

Another method is to use 

At:- 6/4/2018 11:48:48 AM

Login/Register to answer
Register directly by posting answer/details

Full Name *

Email *

By posting your answer you agree on privacy policy & terms of use

Subscribe Now

Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly