{
"cities" : {
"San Francisco" : {
"location Name" : "San Francisco, CA",
"data" : "51.1"
},
"San Jose" : {
"location Name" : "San Jose, CA",
"data" : "52.5"
}
}
}
how to get San Jose, CA?
myJSON.cities.['San Jose'].[location name] doesn’t work
how to get 52.5?
myJSON.cities.['San Jose'].data?
You can’t do both attribute access and indexing. Pick one or the other.
The second is allowed, since each object is accessed independently.