This is a sample of the result after running data=JSON.parse(response) on a value returned by my server (PHP script).
{“value_1”:0,“value_2”:[“a”,“b”]}
I can get the ‘value_1’ value by using data.value_1 but I just can’t get the ‘value_2’ value. It looks like an array so surely data.value_2 gets the array and then I go form there, but it doesn’t work.
Instead of data.value_2[COLOR="#FF0000"].0[/COLOR] and data.value_2[COLOR="#FF0000"].1[/COLOR] you should use data.value_2[COLOR="#FF0000"][0][/COLOR] and data.value_2[COLOR="#FF0000"][1][/COLOR] since data.value_2 is an array, not an object.
You can access an object like it is an array (in this case, data['value_1'] and data['value_2'] both work), but not the other way around.