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

Clarification empty string #92

Open
Haatschii opened this issue Oct 11, 2024 · 2 comments
Open

Clarification empty string #92

Haatschii opened this issue Oct 11, 2024 · 2 comments

Comments

@Haatschii
Copy link

The specs are not 100% clear in my opinion, regarding empty strings. Are those valid Jason Lines?

The second bullet point in the specs says

Each Line is a Valid JSON Value
The most common values will be objects or arrays, but any JSON value is permitted.

This allows two viewpoints:

  • An empty string is invalid, as the first and only line is no valid Json value.
  • It is valid, as there are no lines at all, therefore all lines are valid.

The Validator on the website says it is valid. However it is also somewhat contradictory because a single /n is shown as invalid, although bullet point 3 of the spec says that a single /n at the end of the file is ignored, therefore either both ("", and "/n") should be valid or invalid.

Could you provide some clarification?

@stephenberry
Copy link

I agree with @Haatschii, that empty input should be valid, because JSON Lines is essentially defining an array. If you have an array of arrays there would be no way of indicating a zero length top level array.

@wardi
Copy link
Owner

wardi commented Oct 11, 2024

Thank you we should word this so that it's clear. An empty file is valid but a file with only \n is not because \n indicates the end of a valid record. Any suggestion on better wording?

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

3 participants