Solved by ptrblck in post #2 
              
              
                Depending how the data is stored in the json object, you might be able to directly create a numpy array. 
Your current code doesn’t seem to show the json file. 
This question doesn’t seem to be PyTorch-specific, so you might get a better answer on e.g. StackOverflow.