Created
May 24, 2022 17:01
-
-
Save michelmany/b8625bd9926cb1fc6d88b114e4a48d38 to your computer and use it in GitHub Desktop.
JSON.parse remove invalid string caracter with regex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const newString = JSON.parse(str.replace(/(\{|,)\s*(.+?)\s*:/g, '$1 "$2":')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment