-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Add json validator #65
Conversation
romkatsu
commented
Apr 12, 2020
Q | A |
---|---|
Is bugfix? | ❌ |
New feature? | ✔️ |
Breaks BC? | ❌ |
Tests pass? | ✔️ |
Fixed issues |
- add json validator
- add trait
- edit composer.json
👍 |
Not sure if it really matters but I have a benchmark (if I implemented it correctly) that shows that using regex for validating json is faster, and the bigger the json, the more is the difference. For real world case the difference would not be visible at all, but another disadvantage of using See benchmark |
Also That's due to the fact that PHP implements a superset of JSON specified in RFC 7159 vs older standard that is implemented by javascript and majority: RFC 4267. Also there is a newer revision of json standard: RFC 8259, which I doubt any language implemented at all. |
@armpogart are you sure it is complete regex that validates JSON? |
@samdark The regex is from RFC 4267 section 6. I'll open another discussion (issue) with details posted here and references to all the data I got. There are also json validation test cases on json.org which can be used for json validator testing. Anyways I'll post all the details in an issue reference it here. I think there are some points that need further discussion. |
Alright. Overall benchmarks look good enough to try it. |