Hello I am using the following code to get information form a website.
var info = JSON.parse(
getInfo(
"https://myurl.com"
)
);
The information I get looks like
{"state1":{"gdp":1234},"state2":{"gtd":1234.032},"stat4":{"gdp":1.2},"state5":{"gdp":3453.88},"state332":{"gdp":2107},"state34788":{"gdp":37},"state-retail":{"gdp":13432},"state-snail":{"gdp":27019}}
when I do
info.state2.gdp the program returns 1234.032 and this is correct.
How ever when I do the same thing with one that has "-" it returns an error
example:
info.state-retail.gdp
retruns ReferenceError: retail is not defined