I get a string: "{ a: '123', b: '234'}", I want to make it to be "{ "a": "123", "b": "234" }" by using regex expression. Could anyone explain/guide me how do I do this? The following is my trial.
str.replace(/[']/,'"').replace(/(['"])?([a-z0-9A-Z_\-]+)(['"])?\s*:/g, '"$2":')