I am working with some JSON data from a website.Problem is, it is organized data. It looks like this:
word: {“1”: data, “2”: data}
word2: {“1”: data, “2”: data}
word3: {“1”: data, “2”: data}
and so on. basically, it is a multi dimensional array. Now, to access the data, i should refer to it as (assuming JSON is the object name) JSON.word[2] and JSON.word2[1].
Here is where my problem comes from: the data is dynamic, meaning all the indexes depend on the values of the database, except the number indexes. Since the website outputting the JSON data is mine, i set it up like so: the values numbered in the root of the JSON are the indexes, then each index has 12 values associated with it. Basically, i cannot do JSON.value because i don’t always know the actual values, but i have them stored in an array (using a for cycle cyclying thru the numeric indexes of the JSON). So, is there a way to use a variable as an attribute call? If i want to access JSON.word2[1], can i somehow assign the value “word2” to a variable and go JSON.variable[1]?
Thanks in advance.