So I have a script that generates 4 variables: NAME, SMA, BBLOWER, and BBUPPER with each iteration of a loop, and adds them as a new row to an existing array. So my array is of the form
[[NAME,SMA,BBLOWER,BBUPPER],[NAME,SMA,BBLOWER,BBUPPER],[NAME, SMA,BBLOWER,BBUPPER],etc]
What I'd like to do is rather than add them to an array, I'd like to turn them into a JSON file with a specific structure:
{
"NAME" : [{
"SMA" : <value>,
"BBLOWER" : <value>,
"BBUPPER" : <value>,
}],
"NAME" : [{
"SMA" : <value>,
"BBLOWER" : <value>,
"BBUPPER" : <value>,
}], etc
]
}
Now that I've typed that out I'm not even sure that correct structure. Anyway, I basically want to be able to take the resultant json file and easily extract the SMA value (for example and using the name "VGS") by simply entering something like:
smaValue = json.VGS.SMA
or the BBUPPER of market "VAS" like this:
bbUpperValuer = json.VAS.BBUPPER
Is this approach even practical? There other ways I could do the same thing using the array, but doing it the JSON way just seems more clean and "proper".