How to fix json format error in javascript?

I am using JSON.parse

json string to parse. It works fine for the standard json format string, but I don't work for some string like below:

'{"filter":{"email":/net/}, 
  "rejected":"[/net/,/net/]"
 }'

      

the problem with this line is that it misses the double quote on /net/

, which makes it JSON.parse

unsuccessful. Is there a way to parse this string into a json object? Or is there a library to add a double quote to the missing part of that string? I tried several regex patterns to compose this string, but can't seem to find a good solution.

+3


source to share





All Articles