Friday, February 23, 2024
 Popular · Latest · Hot · Upcoming
-1
rated 0 times [  6] [ 7]  / answers: 1 / hits: 157595  / 12 Years ago, sat, february 11, 2012, 12:00:00

I am trying to inject json into my backbone.js app. My json has " for every quote.



Is there a way for me to remove this?

I've provided a sample below:



[{"Id":1,"Name":"Name}]

More From » javascript

 Answers
43

Presumably you have it in a variable and are using JSON.parse(data);. In which case, use:



JSON.parse(data.replace(/"/g,''));


You might want to fix your JSON-writing script though, because " is not valid in a JSON object.


[#87533] Thursday, February 9, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kaylinshayd

Total Points: 443
Total Questions: 104
Total Answers: 111

Location: Nauru
Member since Wed, Mar 29, 2023
12 Months ago
;