top | item 10282525

(no title)

dlsym | 10 years ago

I wonder, why even bother with wrapping rows in array brackets and not do it implicitly.

    ["Name", "Session", "Score", "Completed"]
    ["Gilbert", "2013", 24, true]
would be

    "Name", "Session", "Score", "Completed"
    "Gilbert", "2013", 24, true
Which is, well, more or less just CSV. This should work with objects too:

    "name": "Jane", "key": { "nested": "object" }, "foo": ["bar"]

Or mixed:

    "Foo", { "fnord": 23 }, true

discuss

order

sandstrom|10 years ago

One benefit with each line being valid JSON is that writing a reader/generator for this format is fairly simple. One can use existing JSON libraries as-is, with some extra consideration to the line-like nature of this format.

For the above to work you'd have to use a custom JSON-parser when reading the lines.

------------

Could also be mentioned that JSONLines-like formats are already pretty common in log-files, database exports etc. So this is more about giving it a name and standardizing it. Which I think is great!

mtdewcmu|10 years ago

>> For the above to work you'd have to use a custom JSON-parser when reading the lines.

Not necessarily. You could just re-add the square brackets before passing the lines to the JSON parser.

That would make more work for the machine, because you'd probably have to copy the whole string. But any time you can make less work for the human by making the machine work a little harder, it's usually a win.

Cidan|10 years ago

Because that's not... JSON?