I need to save some tabular data in JSON format (from a game engine) to read it in Julia as a DataFrame (or IndexedTable). I’m trying to understand what is the best way to save this kind of data in JSON. The following two options make sense to me:
- As a dict of columns:
{"x":[1,2,3],"y":[4,5,6]}
- As a list of dicts separated by newlines to be read as named tuples:
{"x":1,"y":4}
{"x":2,"y":5}
{"x":3,"y":6}
I believe the second option can probably be loaded very efficiently on Julia 0.7 with JSON2 (though I’m not sure) and seems more amenable to implementing the DataStreams interface.
My question is: how should one save tabular data in JSON and what would be the most efficient/recommended way to load it in Julia (as a named tuple of vectors, or a DataFrame or an IndexedTable)?