Given your sample text:
In [814]: txt
Out[814]: '[[{"x" : 1, "y" : 4, "z" : 6},{"x" : 1, "y" : 2, "z" : 8}],[{"x" : 5, "y" : 1, "z" : 6}],[{"x" : 15, "y" : 44, "z" : 6},{"x" : 12, "y" : 22, "z" : 56}]]'
In [818]: data = json.loads(txt)
In [819]: data
Out[819]:
[[{'x': 1, 'y': 4, 'z': 6}, {'x': 1, 'y': 2, 'z': 8}],
[{'x': 5, 'y': 1, 'z': 6}],
[{'x': 15, 'y': 44, 'z': 6}, {'x': 12, 'y': 22, 'z': 56}]]
This is a list of 3 lists. The sublists have 2 or 1 dictionaries. I can see iterating over the dictionaries to consolidate values into one dictionary. For example one with the 3 keys, and a similarly nested list of lists of values. It can't be a regular numpy
array.
Just from reading Out[819]
, I expect we can generate:
In [825]: dd = {'x': [[1,1],[5],[15,12]], 'y':[[4,2],[1],[44,22]], 'z':[[6,8],[6
...: ],[6,56]]}
In [826]: dd
Out[826]:
{'x': [[1, 1], [5], [15, 12]],
'y': [[4, 2], [1], [44, 22]],
'z': [[6, 8], [6], [6, 56]]}
I won't get into the details of iterating through the lists and dictionaries to get that. Nothing tricky or advanced about that, just a bit tedious.
More on consolidating dictionary values
Python: Concatenate many dicts of numpy arrays with same keys and size