var str = '"[]"'; alert(str.replace(new RegExp("\"\\[", 'g'), "[").replace(new RegExp("\\]\"", 'g'), "]"));