Skip to content
Advertisement

how to make json.loads() read a json string with the column names as the first element

I am serializing a datatable from a http get and for performance reasons would prefer to serialize it in a Names, Values structure, so that the first element contains the column names, can json.loads deal with this, if not is there another json parser that will?

JavaScript

(this reduces the size to 20% of a standard JSON stream with the field names repeated for each ‘row’)

Advertisement

Answer

I did some digging and found ijson. It lets you iterate over a json file and access its objects. you can build you data structur like this(i was lazy and used pd):

JavaScript
Advertisement