McJSON icon indicating copy to clipboard operation
McJSON copied to clipboard

Empty string passed Check validation.

Open mnabarro opened this issue 1 year ago • 3 comments
trafficstars

Hi! Thanks for this project. I'm using it to validate json files and an empty string passes validation and I think it should not.

mnabarro avatar Jun 20 '24 21:06 mnabarro

Hi,

Thanks for your feedback.

See, empty values are valid as in {"k":""}.

Also, empty keys are valid like this: {"":"v"}.

See JSON Lint as reference.

Regards,

Marcelo.

hydrobyte avatar Jun 20 '24 21:06 hydrobyte

Thanks you for your quick response. I know that empty strings are valid as keys or values but, what I was trying to say is that, if you pass an empty string to validate ( i.e. check('') ) it returns true and it should return false, just like JSON Lint does if you simply click on the [Validate JSON] button without any text in the textarea.

Best regards.

mnabarro avatar Jun 20 '24 21:06 mnabarro

Oh, Now I got it. It is simple to implement. Meanwhile, you can check strings that are not empty, right? :-) I'll share it in next update. Best.

hydrobyte avatar Jun 21 '24 11:06 hydrobyte

Done! Sorry for the delay.

hydrobyte avatar Sep 19 '24 18:09 hydrobyte