wardi / jsonlines

Documentation for the JSON Lines text file format
http://jsonlines.org
134 stars 33 forks source link

Clarification empty string #92

Open Haatschii opened 1 week ago

Haatschii commented 1 week ago

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:

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 commented 1 week ago

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 commented 1 week ago

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?