Have you ever seen/generated tabular data in JSON?...
# present-company
m
Have you ever seen/generated tabular data in JSON? If it wasn't one of the formats below, could you tell me? Thanks!
Copy code
listOfObjects = [{col1: 1, col2, true, col3: "text"}, ....]

csvArrayWithCols = [["col1", "col2", "col3"], [1, true, "text], ...]

csvArrayWithColsNoHeaders = [[1, true, "text], ...]

csvObject = {cols: ["col1", "col2", "col3"], rows: [[1, true, "text], ...]}
c
The only other format I can think of would be
{"col1":[row1val, row2val], "col2":["row1val", "row2val"]}
i.e. CSV but by column not row. Can't remember if I've ever seen it in the wild.
a
I definitely have seen that occasionally in extracts from systems using column store dbs -- whether it's a good practice is another question
b
@Chris Knott’s one is very useful and used very often. At Our World in Data we were using a column oriented store, then as part of a refactor I switched us to a table based store, but perf was far worse so then we refactored that bit back to columns
(If you're doing a lot of transformations, column first is the way to go for perf, and then do JIT to tables when serializing/deserializing)
a
Sure, didn't mean to question column store themselves... I'm just not sure where the intersection of "benefits from columnar data" and "should be using json" exists
In my mind, if you've gone to json, it's usually for smaller data sizes and data interchange cases
...at which point I'd favor the more common and universal row formats
(though totally understand that just sticking with the "native" major ordering might be the path of least resistance in some cases)