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

isJson and primitives #1327

Closed
matthieu88160 opened this issue May 29, 2020 · 1 comment
Closed

isJson and primitives #1327

matthieu88160 opened this issue May 29, 2020 · 1 comment

Comments

@matthieu88160
Copy link
Contributor

Hi,

I'm using the validator.js as the main validator of form in our company framework. Implementing tests for our component I discovered that the isJson validator doesn't accept the primitives JSON types as valid JSON if they are not encapsulated in an object. Trying to fix it I also discovered that the tests of the validator.js expect these values to be rejected.

Even if these types are not defined as valid types in the initial JSON RFC-4627, the RFC-7159 that obsolete the 4627 strictly defines the four primitives (strings, numbers, booleans, and null) as valid JSON types, making the following valid :

  • "null"
  • "true"
  • "false"

I noticed that "false" is also considered as an invalid JSON regarding the tests.

My question is: is there a good reason to make them invalid?

@profnandaa
Copy link
Member

PR #1328

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

No branches or pull requests

2 participants