I did a search through the site, but it’s still not working.
var blah2 = JSON.stringify({foo: 123, bar: <x><y></y></x>, baz: 123});
this is what I tried:
blah2.replace(/[{}]/g, "");
this is what it the string comes out to:
got "{\"baz\":123,\"foo\":123}"
(i know this is probably a newb question, but this is my first time working with javascript and i just don’t know what i’m missing)
Javascript strings are immutable. When you call
blah2.replace, you are not replacing something insideblah2, you are creating a new string. What you probably want is: