Found some really interesting qualities of JSON. My array of objects was being saved as an array of arrays. That might have had something to do with the fact that the keys of the objects were numbers. I have changes the keys to the name of the dimension, and the problem went away. I therefore changed the code so that it does not fetch the index of the dimension, but the name. Hopefully this does not create problems later on. I will have to rewrite the code that writes the sound bits