Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

当自定义的元素接收Object参数时,某些合法数据,正则校验处理有问题,会导致JSON.parse报错 #771

Closed
wangnannanziyu opened this issue May 17, 2023 · 3 comments

Comments

@wangnannanziyu
Copy link

例如这个对象{"remark":"TEST:12321"},使用/(['"])?([a-zA-Z0-9_-]+)(['"])?:([^\/])/g进行处理时,会变成'{"remark":""TEST":12321"}',处理后的对象不再是合法的JSON字符串

@dntzhang
Copy link
Collaborator

看来只能用 eval 了?

dntzhang added a commit that referenced this issue May 18, 2023
@dntzhang
Copy link
Collaborator

已处理

@wangnannanziyu
Copy link
Author

已处理

之前就没看懂为啥要加这一段正则处理,现在这样没毛病,用户自己保证传递的JSON字符串必须要合法👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants